
obj/user/pingpongs.debug:     file format elf32-i386


Disassembly of section .text:

00800020 <_start>:
// starts us running when we are initially loaded into a new environment.
.text
.globl _start
_start:
	// See if we were started with arguments on the stack
	cmpl $USTACKTOP, %esp
  800020:	81 fc 00 e0 bf ee    	cmp    $0xeebfe000,%esp
	jne args_exist
  800026:	75 04                	jne    80002c <args_exist>

	// If not, push dummy argc/argv arguments.
	// This happens when we are loaded by the kernel,
	// because the kernel does not know about passing arguments.
	pushl $0
  800028:	6a 00                	push   $0x0
	pushl $0
  80002a:	6a 00                	push   $0x0

0080002c <args_exist>:

args_exist:
	call libmain
  80002c:	e8 d6 00 00 00       	call   800107 <libmain>
1:	jmp 1b
  800031:	eb fe                	jmp    800031 <args_exist+0x5>

00800033 <umain>:

uint32_t val;

void
umain(int argc, char **argv)
{
  800033:	f3 0f 1e fb          	endbr32 
  800037:	55                   	push   %ebp
  800038:	89 e5                	mov    %esp,%ebp
  80003a:	57                   	push   %edi
  80003b:	56                   	push   %esi
  80003c:	53                   	push   %ebx
  80003d:	83 ec 2c             	sub    $0x2c,%esp
	envid_t who;
	uint32_t i;

	i = 0;
	if ((who = sfork()) != 0) {
  800040:	e8 20 11 00 00       	call   801165 <sfork>
  800045:	89 45 e4             	mov    %eax,-0x1c(%ebp)
  800048:	85 c0                	test   %eax,%eax
  80004a:	75 74                	jne    8000c0 <umain+0x8d>
		cprintf("send 0 from %x to %x\n", sys_getenvid(), who);
		ipc_send(who, 0, 0, 0);
	}

	while (1) {
		ipc_recv(&who, 0, 0);
  80004c:	83 ec 04             	sub    $0x4,%esp
  80004f:	6a 00                	push   $0x0
  800051:	6a 00                	push   $0x0
  800053:	8d 45 e4             	lea    -0x1c(%ebp),%eax
  800056:	50                   	push   %eax
  800057:	e8 27 11 00 00       	call   801183 <ipc_recv>
		cprintf("%x got %d from %x (thisenv is %p %x)\n", sys_getenvid(), val, who, thisenv, thisenv->env_id);
  80005c:	8b 1d 08 40 80 00    	mov    0x804008,%ebx
  800062:	8b 7b 48             	mov    0x48(%ebx),%edi
  800065:	8b 75 e4             	mov    -0x1c(%ebp),%esi
  800068:	a1 04 40 80 00       	mov    0x804004,%eax
  80006d:	89 45 d4             	mov    %eax,-0x2c(%ebp)
  800070:	e8 76 0b 00 00       	call   800beb <sys_getenvid>
  800075:	83 c4 08             	add    $0x8,%esp
  800078:	57                   	push   %edi
  800079:	53                   	push   %ebx
  80007a:	56                   	push   %esi
  80007b:	ff 75 d4             	pushl  -0x2c(%ebp)
  80007e:	50                   	push   %eax
  80007f:	68 b0 23 80 00       	push   $0x8023b0
  800084:	e8 8d 01 00 00       	call   800216 <cprintf>
		if (val == 10)
  800089:	a1 04 40 80 00       	mov    0x804004,%eax
  80008e:	83 c4 20             	add    $0x20,%esp
  800091:	83 f8 0a             	cmp    $0xa,%eax
  800094:	74 22                	je     8000b8 <umain+0x85>
			return;
		++val;
  800096:	83 c0 01             	add    $0x1,%eax
  800099:	a3 04 40 80 00       	mov    %eax,0x804004
		ipc_send(who, 0, 0, 0);
  80009e:	6a 00                	push   $0x0
  8000a0:	6a 00                	push   $0x0
  8000a2:	6a 00                	push   $0x0
  8000a4:	ff 75 e4             	pushl  -0x1c(%ebp)
  8000a7:	e8 58 11 00 00       	call   801204 <ipc_send>
		if (val == 10)
  8000ac:	83 c4 10             	add    $0x10,%esp
  8000af:	83 3d 04 40 80 00 0a 	cmpl   $0xa,0x804004
  8000b6:	75 94                	jne    80004c <umain+0x19>
			return;
	}

}
  8000b8:	8d 65 f4             	lea    -0xc(%ebp),%esp
  8000bb:	5b                   	pop    %ebx
  8000bc:	5e                   	pop    %esi
  8000bd:	5f                   	pop    %edi
  8000be:	5d                   	pop    %ebp
  8000bf:	c3                   	ret    
		cprintf("i am %08x; thisenv is %p\n", sys_getenvid(), thisenv);
  8000c0:	8b 1d 08 40 80 00    	mov    0x804008,%ebx
  8000c6:	e8 20 0b 00 00       	call   800beb <sys_getenvid>
  8000cb:	83 ec 04             	sub    $0x4,%esp
  8000ce:	53                   	push   %ebx
  8000cf:	50                   	push   %eax
  8000d0:	68 80 23 80 00       	push   $0x802380
  8000d5:	e8 3c 01 00 00       	call   800216 <cprintf>
		cprintf("send 0 from %x to %x\n", sys_getenvid(), who);
  8000da:	8b 5d e4             	mov    -0x1c(%ebp),%ebx
  8000dd:	e8 09 0b 00 00       	call   800beb <sys_getenvid>
  8000e2:	83 c4 0c             	add    $0xc,%esp
  8000e5:	53                   	push   %ebx
  8000e6:	50                   	push   %eax
  8000e7:	68 9a 23 80 00       	push   $0x80239a
  8000ec:	e8 25 01 00 00       	call   800216 <cprintf>
		ipc_send(who, 0, 0, 0);
  8000f1:	6a 00                	push   $0x0
  8000f3:	6a 00                	push   $0x0
  8000f5:	6a 00                	push   $0x0
  8000f7:	ff 75 e4             	pushl  -0x1c(%ebp)
  8000fa:	e8 05 11 00 00       	call   801204 <ipc_send>
  8000ff:	83 c4 20             	add    $0x20,%esp
  800102:	e9 45 ff ff ff       	jmp    80004c <umain+0x19>

00800107 <libmain>:
const volatile struct Env *thisenv;
const char *binaryname = "<unknown>";

void
libmain(int argc, char **argv)
{
  800107:	f3 0f 1e fb          	endbr32 
  80010b:	55                   	push   %ebp
  80010c:	89 e5                	mov    %esp,%ebp
  80010e:	56                   	push   %esi
  80010f:	53                   	push   %ebx
  800110:	8b 5d 08             	mov    0x8(%ebp),%ebx
  800113:	8b 75 0c             	mov    0xc(%ebp),%esi
	;    //系统调用，我们已经在Exercise 7中实现了
	
	
	
	//屏幕上打印出来了字母，但后续报错了，有意思，让我看看问题出现在哪。
	thisenv=0;
  800116:	c7 05 08 40 80 00 00 	movl   $0x0,0x804008
  80011d:	00 00 00 
	thisenv = &envs[ENVX(sys_getenvid())];      //获取Env结构指针
  800120:	e8 c6 0a 00 00       	call   800beb <sys_getenvid>
  800125:	25 ff 03 00 00       	and    $0x3ff,%eax
  80012a:	6b c0 7c             	imul   $0x7c,%eax,%eax
  80012d:	05 00 00 c0 ee       	add    $0xeec00000,%eax
  800132:	a3 08 40 80 00       	mov    %eax,0x804008

	// save the name of the program so that panic() can use it
	if (argc > 0)
  800137:	85 db                	test   %ebx,%ebx
  800139:	7e 07                	jle    800142 <libmain+0x3b>
		binaryname = argv[0];
  80013b:	8b 06                	mov    (%esi),%eax
  80013d:	a3 00 30 80 00       	mov    %eax,0x803000

	// call user main routine
	umain(argc, argv);
  800142:	83 ec 08             	sub    $0x8,%esp
  800145:	56                   	push   %esi
  800146:	53                   	push   %ebx
  800147:	e8 e7 fe ff ff       	call   800033 <umain>

	// exit gracefully
	exit();
  80014c:	e8 0a 00 00 00       	call   80015b <exit>
}
  800151:	83 c4 10             	add    $0x10,%esp
  800154:	8d 65 f8             	lea    -0x8(%ebp),%esp
  800157:	5b                   	pop    %ebx
  800158:	5e                   	pop    %esi
  800159:	5d                   	pop    %ebp
  80015a:	c3                   	ret    

0080015b <exit>:

#include <inc/lib.h>

void
exit(void)
{
  80015b:	f3 0f 1e fb          	endbr32 
  80015f:	55                   	push   %ebp
  800160:	89 e5                	mov    %esp,%ebp
  800162:	83 ec 08             	sub    $0x8,%esp
	close_all();
  800165:	e8 1e 13 00 00       	call   801488 <close_all>
	sys_env_destroy(0);
  80016a:	83 ec 0c             	sub    $0xc,%esp
  80016d:	6a 00                	push   $0x0
  80016f:	e8 32 0a 00 00       	call   800ba6 <sys_env_destroy>
}
  800174:	83 c4 10             	add    $0x10,%esp
  800177:	c9                   	leave  
  800178:	c3                   	ret    

00800179 <putch>:
};


static void
putch(int ch, struct printbuf *b)
{
  800179:	f3 0f 1e fb          	endbr32 
  80017d:	55                   	push   %ebp
  80017e:	89 e5                	mov    %esp,%ebp
  800180:	53                   	push   %ebx
  800181:	83 ec 04             	sub    $0x4,%esp
  800184:	8b 5d 0c             	mov    0xc(%ebp),%ebx
	b->buf[b->idx++] = ch;
  800187:	8b 13                	mov    (%ebx),%edx
  800189:	8d 42 01             	lea    0x1(%edx),%eax
  80018c:	89 03                	mov    %eax,(%ebx)
  80018e:	8b 4d 08             	mov    0x8(%ebp),%ecx
  800191:	88 4c 13 08          	mov    %cl,0x8(%ebx,%edx,1)
	if (b->idx == 256-1) {
  800195:	3d ff 00 00 00       	cmp    $0xff,%eax
  80019a:	74 09                	je     8001a5 <putch+0x2c>
		sys_cputs(b->buf, b->idx);
		b->idx = 0;
	}
	b->cnt++;
  80019c:	83 43 04 01          	addl   $0x1,0x4(%ebx)
}
  8001a0:	8b 5d fc             	mov    -0x4(%ebp),%ebx
  8001a3:	c9                   	leave  
  8001a4:	c3                   	ret    
		sys_cputs(b->buf, b->idx);
  8001a5:	83 ec 08             	sub    $0x8,%esp
  8001a8:	68 ff 00 00 00       	push   $0xff
  8001ad:	8d 43 08             	lea    0x8(%ebx),%eax
  8001b0:	50                   	push   %eax
  8001b1:	e8 ab 09 00 00       	call   800b61 <sys_cputs>
		b->idx = 0;
  8001b6:	c7 03 00 00 00 00    	movl   $0x0,(%ebx)
  8001bc:	83 c4 10             	add    $0x10,%esp
  8001bf:	eb db                	jmp    80019c <putch+0x23>

008001c1 <vcprintf>:

int
vcprintf(const char *fmt, va_list ap)
{
  8001c1:	f3 0f 1e fb          	endbr32 
  8001c5:	55                   	push   %ebp
  8001c6:	89 e5                	mov    %esp,%ebp
  8001c8:	81 ec 18 01 00 00    	sub    $0x118,%esp
	struct printbuf b;

	b.idx = 0;
  8001ce:	c7 85 f0 fe ff ff 00 	movl   $0x0,-0x110(%ebp)
  8001d5:	00 00 00 
	b.cnt = 0;
  8001d8:	c7 85 f4 fe ff ff 00 	movl   $0x0,-0x10c(%ebp)
  8001df:	00 00 00 
	vprintfmt((void*)putch, &b, fmt, ap);
  8001e2:	ff 75 0c             	pushl  0xc(%ebp)
  8001e5:	ff 75 08             	pushl  0x8(%ebp)
  8001e8:	8d 85 f0 fe ff ff    	lea    -0x110(%ebp),%eax
  8001ee:	50                   	push   %eax
  8001ef:	68 79 01 80 00       	push   $0x800179
  8001f4:	e8 20 01 00 00       	call   800319 <vprintfmt>
	sys_cputs(b.buf, b.idx);
  8001f9:	83 c4 08             	add    $0x8,%esp
  8001fc:	ff b5 f0 fe ff ff    	pushl  -0x110(%ebp)
  800202:	8d 85 f8 fe ff ff    	lea    -0x108(%ebp),%eax
  800208:	50                   	push   %eax
  800209:	e8 53 09 00 00       	call   800b61 <sys_cputs>

	return b.cnt;
}
  80020e:	8b 85 f4 fe ff ff    	mov    -0x10c(%ebp),%eax
  800214:	c9                   	leave  
  800215:	c3                   	ret    

00800216 <cprintf>:

int
cprintf(const char *fmt, ...)
{
  800216:	f3 0f 1e fb          	endbr32 
  80021a:	55                   	push   %ebp
  80021b:	89 e5                	mov    %esp,%ebp
  80021d:	83 ec 10             	sub    $0x10,%esp
	va_list ap;
	int cnt;

	va_start(ap, fmt);
  800220:	8d 45 0c             	lea    0xc(%ebp),%eax
	cnt = vcprintf(fmt, ap);
  800223:	50                   	push   %eax
  800224:	ff 75 08             	pushl  0x8(%ebp)
  800227:	e8 95 ff ff ff       	call   8001c1 <vcprintf>
	va_end(ap);

	return cnt;
}
  80022c:	c9                   	leave  
  80022d:	c3                   	ret    

0080022e <printnum>:
 * using specified putch function and associated pointer putdat.
 */
static void
printnum(void (*putch)(int, void*), void *putdat,
	 unsigned long long num, unsigned base, int width, int padc)
{
  80022e:	55                   	push   %ebp
  80022f:	89 e5                	mov    %esp,%ebp
  800231:	57                   	push   %edi
  800232:	56                   	push   %esi
  800233:	53                   	push   %ebx
  800234:	83 ec 1c             	sub    $0x1c,%esp
  800237:	89 c7                	mov    %eax,%edi
  800239:	89 d6                	mov    %edx,%esi
  80023b:	8b 45 08             	mov    0x8(%ebp),%eax
  80023e:	8b 55 0c             	mov    0xc(%ebp),%edx
  800241:	89 d1                	mov    %edx,%ecx
  800243:	89 c2                	mov    %eax,%edx
  800245:	89 45 d8             	mov    %eax,-0x28(%ebp)
  800248:	89 4d dc             	mov    %ecx,-0x24(%ebp)
  80024b:	8b 45 10             	mov    0x10(%ebp),%eax
  80024e:	8b 5d 14             	mov    0x14(%ebp),%ebx
	// first recursively print all preceding (more significant) digits
	if (num >= base) {
  800251:	89 45 e0             	mov    %eax,-0x20(%ebp)
  800254:	c7 45 e4 00 00 00 00 	movl   $0x0,-0x1c(%ebp)
  80025b:	39 c2                	cmp    %eax,%edx
  80025d:	1b 4d e4             	sbb    -0x1c(%ebp),%ecx
  800260:	72 3e                	jb     8002a0 <printnum+0x72>
		printnum(putch, putdat, num / base, base, width - 1, padc);
  800262:	83 ec 0c             	sub    $0xc,%esp
  800265:	ff 75 18             	pushl  0x18(%ebp)
  800268:	83 eb 01             	sub    $0x1,%ebx
  80026b:	53                   	push   %ebx
  80026c:	50                   	push   %eax
  80026d:	83 ec 08             	sub    $0x8,%esp
  800270:	ff 75 e4             	pushl  -0x1c(%ebp)
  800273:	ff 75 e0             	pushl  -0x20(%ebp)
  800276:	ff 75 dc             	pushl  -0x24(%ebp)
  800279:	ff 75 d8             	pushl  -0x28(%ebp)
  80027c:	e8 8f 1e 00 00       	call   802110 <__udivdi3>
  800281:	83 c4 18             	add    $0x18,%esp
  800284:	52                   	push   %edx
  800285:	50                   	push   %eax
  800286:	89 f2                	mov    %esi,%edx
  800288:	89 f8                	mov    %edi,%eax
  80028a:	e8 9f ff ff ff       	call   80022e <printnum>
  80028f:	83 c4 20             	add    $0x20,%esp
  800292:	eb 13                	jmp    8002a7 <printnum+0x79>
	} else {
		// print any needed pad characters before first digit
		while (--width > 0)
			putch(padc, putdat);
  800294:	83 ec 08             	sub    $0x8,%esp
  800297:	56                   	push   %esi
  800298:	ff 75 18             	pushl  0x18(%ebp)
  80029b:	ff d7                	call   *%edi
  80029d:	83 c4 10             	add    $0x10,%esp
		while (--width > 0)
  8002a0:	83 eb 01             	sub    $0x1,%ebx
  8002a3:	85 db                	test   %ebx,%ebx
  8002a5:	7f ed                	jg     800294 <printnum+0x66>
	}

	// then print this (the least significant) digit
	putch("0123456789abcdef"[num % base], putdat);
  8002a7:	83 ec 08             	sub    $0x8,%esp
  8002aa:	56                   	push   %esi
  8002ab:	83 ec 04             	sub    $0x4,%esp
  8002ae:	ff 75 e4             	pushl  -0x1c(%ebp)
  8002b1:	ff 75 e0             	pushl  -0x20(%ebp)
  8002b4:	ff 75 dc             	pushl  -0x24(%ebp)
  8002b7:	ff 75 d8             	pushl  -0x28(%ebp)
  8002ba:	e8 61 1f 00 00       	call   802220 <__umoddi3>
  8002bf:	83 c4 14             	add    $0x14,%esp
  8002c2:	0f be 80 e0 23 80 00 	movsbl 0x8023e0(%eax),%eax
  8002c9:	50                   	push   %eax
  8002ca:	ff d7                	call   *%edi
}
  8002cc:	83 c4 10             	add    $0x10,%esp
  8002cf:	8d 65 f4             	lea    -0xc(%ebp),%esp
  8002d2:	5b                   	pop    %ebx
  8002d3:	5e                   	pop    %esi
  8002d4:	5f                   	pop    %edi
  8002d5:	5d                   	pop    %ebp
  8002d6:	c3                   	ret    

008002d7 <sprintputch>:
	int cnt;
};

static void
sprintputch(int ch, struct sprintbuf *b)
{
  8002d7:	f3 0f 1e fb          	endbr32 
  8002db:	55                   	push   %ebp
  8002dc:	89 e5                	mov    %esp,%ebp
  8002de:	8b 45 0c             	mov    0xc(%ebp),%eax
	b->cnt++;
  8002e1:	83 40 08 01          	addl   $0x1,0x8(%eax)
	if (b->buf < b->ebuf)
  8002e5:	8b 10                	mov    (%eax),%edx
  8002e7:	3b 50 04             	cmp    0x4(%eax),%edx
  8002ea:	73 0a                	jae    8002f6 <sprintputch+0x1f>
		*b->buf++ = ch;
  8002ec:	8d 4a 01             	lea    0x1(%edx),%ecx
  8002ef:	89 08                	mov    %ecx,(%eax)
  8002f1:	8b 45 08             	mov    0x8(%ebp),%eax
  8002f4:	88 02                	mov    %al,(%edx)
}
  8002f6:	5d                   	pop    %ebp
  8002f7:	c3                   	ret    

008002f8 <printfmt>:
{
  8002f8:	f3 0f 1e fb          	endbr32 
  8002fc:	55                   	push   %ebp
  8002fd:	89 e5                	mov    %esp,%ebp
  8002ff:	83 ec 08             	sub    $0x8,%esp
	va_start(ap, fmt);
  800302:	8d 45 14             	lea    0x14(%ebp),%eax
	vprintfmt(putch, putdat, fmt, ap);
  800305:	50                   	push   %eax
  800306:	ff 75 10             	pushl  0x10(%ebp)
  800309:	ff 75 0c             	pushl  0xc(%ebp)
  80030c:	ff 75 08             	pushl  0x8(%ebp)
  80030f:	e8 05 00 00 00       	call   800319 <vprintfmt>
}
  800314:	83 c4 10             	add    $0x10,%esp
  800317:	c9                   	leave  
  800318:	c3                   	ret    

00800319 <vprintfmt>:
{
  800319:	f3 0f 1e fb          	endbr32 
  80031d:	55                   	push   %ebp
  80031e:	89 e5                	mov    %esp,%ebp
  800320:	57                   	push   %edi
  800321:	56                   	push   %esi
  800322:	53                   	push   %ebx
  800323:	83 ec 3c             	sub    $0x3c,%esp
  800326:	8b 75 08             	mov    0x8(%ebp),%esi
  800329:	8b 5d 0c             	mov    0xc(%ebp),%ebx
  80032c:	8b 7d 10             	mov    0x10(%ebp),%edi
  80032f:	e9 5d 03 00 00       	jmp    800691 <vprintfmt+0x378>
		padc = ' ';
  800334:	c6 45 d3 20          	movb   $0x20,-0x2d(%ebp)
		altflag = 0;
  800338:	c7 45 e0 00 00 00 00 	movl   $0x0,-0x20(%ebp)
		precision = -1;
  80033f:	c7 45 d8 ff ff ff ff 	movl   $0xffffffff,-0x28(%ebp)
		width = -1;
  800346:	c7 45 d4 ff ff ff ff 	movl   $0xffffffff,-0x2c(%ebp)
		lflag = 0;
  80034d:	b9 00 00 00 00       	mov    $0x0,%ecx
		switch (ch = *(unsigned char *) fmt++) {
  800352:	8d 47 01             	lea    0x1(%edi),%eax
  800355:	89 45 e4             	mov    %eax,-0x1c(%ebp)
  800358:	0f b6 17             	movzbl (%edi),%edx
  80035b:	8d 42 dd             	lea    -0x23(%edx),%eax
  80035e:	3c 55                	cmp    $0x55,%al
  800360:	0f 87 ae 03 00 00    	ja     800714 <vprintfmt+0x3fb>
  800366:	0f b6 c0             	movzbl %al,%eax
  800369:	3e ff 24 85 20 25 80 	notrack jmp *0x802520(,%eax,4)
  800370:	00 
  800371:	8b 7d e4             	mov    -0x1c(%ebp),%edi
			padc = '-';
  800374:	c6 45 d3 2d          	movb   $0x2d,-0x2d(%ebp)
  800378:	eb d8                	jmp    800352 <vprintfmt+0x39>
		switch (ch = *(unsigned char *) fmt++) {
  80037a:	8b 7d e4             	mov    -0x1c(%ebp),%edi
  80037d:	c6 45 d3 30          	movb   $0x30,-0x2d(%ebp)
  800381:	eb cf                	jmp    800352 <vprintfmt+0x39>
  800383:	0f b6 d2             	movzbl %dl,%edx
  800386:	8b 7d e4             	mov    -0x1c(%ebp),%edi
			for (precision = 0; ; ++fmt) {
  800389:	b8 00 00 00 00       	mov    $0x0,%eax
  80038e:	89 4d e4             	mov    %ecx,-0x1c(%ebp)
				precision = precision * 10 + ch - '0';
  800391:	8d 04 80             	lea    (%eax,%eax,4),%eax
  800394:	8d 44 42 d0          	lea    -0x30(%edx,%eax,2),%eax
				ch = *fmt;
  800398:	0f be 17             	movsbl (%edi),%edx
				if (ch < '0' || ch > '9')
  80039b:	8d 4a d0             	lea    -0x30(%edx),%ecx
  80039e:	83 f9 09             	cmp    $0x9,%ecx
  8003a1:	77 55                	ja     8003f8 <vprintfmt+0xdf>
			for (precision = 0; ; ++fmt) {
  8003a3:	83 c7 01             	add    $0x1,%edi
				precision = precision * 10 + ch - '0';
  8003a6:	eb e9                	jmp    800391 <vprintfmt+0x78>
			precision = va_arg(ap, int);
  8003a8:	8b 45 14             	mov    0x14(%ebp),%eax
  8003ab:	8b 00                	mov    (%eax),%eax
  8003ad:	89 45 d8             	mov    %eax,-0x28(%ebp)
  8003b0:	8b 45 14             	mov    0x14(%ebp),%eax
  8003b3:	8d 40 04             	lea    0x4(%eax),%eax
  8003b6:	89 45 14             	mov    %eax,0x14(%ebp)
		switch (ch = *(unsigned char *) fmt++) {
  8003b9:	8b 7d e4             	mov    -0x1c(%ebp),%edi
			if (width < 0)
  8003bc:	83 7d d4 00          	cmpl   $0x0,-0x2c(%ebp)
  8003c0:	79 90                	jns    800352 <vprintfmt+0x39>
				width = precision, precision = -1;
  8003c2:	8b 45 d8             	mov    -0x28(%ebp),%eax
  8003c5:	89 45 d4             	mov    %eax,-0x2c(%ebp)
  8003c8:	c7 45 d8 ff ff ff ff 	movl   $0xffffffff,-0x28(%ebp)
  8003cf:	eb 81                	jmp    800352 <vprintfmt+0x39>
  8003d1:	8b 45 d4             	mov    -0x2c(%ebp),%eax
  8003d4:	85 c0                	test   %eax,%eax
  8003d6:	ba 00 00 00 00       	mov    $0x0,%edx
  8003db:	0f 49 d0             	cmovns %eax,%edx
  8003de:	89 55 d4             	mov    %edx,-0x2c(%ebp)
		switch (ch = *(unsigned char *) fmt++) {
  8003e1:	8b 7d e4             	mov    -0x1c(%ebp),%edi
			goto reswitch;
  8003e4:	e9 69 ff ff ff       	jmp    800352 <vprintfmt+0x39>
		switch (ch = *(unsigned char *) fmt++) {
  8003e9:	8b 7d e4             	mov    -0x1c(%ebp),%edi
			altflag = 1;
  8003ec:	c7 45 e0 01 00 00 00 	movl   $0x1,-0x20(%ebp)
			goto reswitch;
  8003f3:	e9 5a ff ff ff       	jmp    800352 <vprintfmt+0x39>
  8003f8:	8b 4d e4             	mov    -0x1c(%ebp),%ecx
  8003fb:	89 45 d8             	mov    %eax,-0x28(%ebp)
  8003fe:	eb bc                	jmp    8003bc <vprintfmt+0xa3>
			lflag++;
  800400:	83 c1 01             	add    $0x1,%ecx
		switch (ch = *(unsigned char *) fmt++) {
  800403:	8b 7d e4             	mov    -0x1c(%ebp),%edi
			goto reswitch;
  800406:	e9 47 ff ff ff       	jmp    800352 <vprintfmt+0x39>
			putch(va_arg(ap, int), putdat);
  80040b:	8b 45 14             	mov    0x14(%ebp),%eax
  80040e:	8d 78 04             	lea    0x4(%eax),%edi
  800411:	83 ec 08             	sub    $0x8,%esp
  800414:	53                   	push   %ebx
  800415:	ff 30                	pushl  (%eax)
  800417:	ff d6                	call   *%esi
			break;
  800419:	83 c4 10             	add    $0x10,%esp
			putch(va_arg(ap, int), putdat);
  80041c:	89 7d 14             	mov    %edi,0x14(%ebp)
			break;
  80041f:	e9 6a 02 00 00       	jmp    80068e <vprintfmt+0x375>
			err = va_arg(ap, int);
  800424:	8b 45 14             	mov    0x14(%ebp),%eax
  800427:	8d 78 04             	lea    0x4(%eax),%edi
  80042a:	8b 00                	mov    (%eax),%eax
  80042c:	99                   	cltd   
  80042d:	31 d0                	xor    %edx,%eax
  80042f:	29 d0                	sub    %edx,%eax
			if (err >= MAXERROR || (p = error_string[err]) == NULL)
  800431:	83 f8 0f             	cmp    $0xf,%eax
  800434:	7f 23                	jg     800459 <vprintfmt+0x140>
  800436:	8b 14 85 80 26 80 00 	mov    0x802680(,%eax,4),%edx
  80043d:	85 d2                	test   %edx,%edx
  80043f:	74 18                	je     800459 <vprintfmt+0x140>
				printfmt(putch, putdat, "%s", p);
  800441:	52                   	push   %edx
  800442:	68 21 29 80 00       	push   $0x802921
  800447:	53                   	push   %ebx
  800448:	56                   	push   %esi
  800449:	e8 aa fe ff ff       	call   8002f8 <printfmt>
  80044e:	83 c4 10             	add    $0x10,%esp
			err = va_arg(ap, int);
  800451:	89 7d 14             	mov    %edi,0x14(%ebp)
  800454:	e9 35 02 00 00       	jmp    80068e <vprintfmt+0x375>
				printfmt(putch, putdat, "error %d", err);
  800459:	50                   	push   %eax
  80045a:	68 f8 23 80 00       	push   $0x8023f8
  80045f:	53                   	push   %ebx
  800460:	56                   	push   %esi
  800461:	e8 92 fe ff ff       	call   8002f8 <printfmt>
  800466:	83 c4 10             	add    $0x10,%esp
			err = va_arg(ap, int);
  800469:	89 7d 14             	mov    %edi,0x14(%ebp)
				printfmt(putch, putdat, "error %d", err);
  80046c:	e9 1d 02 00 00       	jmp    80068e <vprintfmt+0x375>
			if ((p = va_arg(ap, char *)) == NULL)
  800471:	8b 45 14             	mov    0x14(%ebp),%eax
  800474:	83 c0 04             	add    $0x4,%eax
  800477:	89 45 c8             	mov    %eax,-0x38(%ebp)
  80047a:	8b 45 14             	mov    0x14(%ebp),%eax
  80047d:	8b 10                	mov    (%eax),%edx
				p = "(null)";
  80047f:	85 d2                	test   %edx,%edx
  800481:	b8 f1 23 80 00       	mov    $0x8023f1,%eax
  800486:	0f 45 c2             	cmovne %edx,%eax
  800489:	89 45 cc             	mov    %eax,-0x34(%ebp)
			if (width > 0 && padc != '-')
  80048c:	83 7d d4 00          	cmpl   $0x0,-0x2c(%ebp)
  800490:	7e 06                	jle    800498 <vprintfmt+0x17f>
  800492:	80 7d d3 2d          	cmpb   $0x2d,-0x2d(%ebp)
  800496:	75 0d                	jne    8004a5 <vprintfmt+0x18c>
				for (width -= strnlen(p, precision); width > 0; width--)
  800498:	8b 45 cc             	mov    -0x34(%ebp),%eax
  80049b:	89 c7                	mov    %eax,%edi
  80049d:	03 45 d4             	add    -0x2c(%ebp),%eax
  8004a0:	89 45 d4             	mov    %eax,-0x2c(%ebp)
  8004a3:	eb 55                	jmp    8004fa <vprintfmt+0x1e1>
  8004a5:	83 ec 08             	sub    $0x8,%esp
  8004a8:	ff 75 d8             	pushl  -0x28(%ebp)
  8004ab:	ff 75 cc             	pushl  -0x34(%ebp)
  8004ae:	e8 15 03 00 00       	call   8007c8 <strnlen>
  8004b3:	8b 55 d4             	mov    -0x2c(%ebp),%edx
  8004b6:	29 c2                	sub    %eax,%edx
  8004b8:	89 55 c4             	mov    %edx,-0x3c(%ebp)
  8004bb:	83 c4 10             	add    $0x10,%esp
  8004be:	89 d7                	mov    %edx,%edi
					putch(padc, putdat);
  8004c0:	0f be 45 d3          	movsbl -0x2d(%ebp),%eax
  8004c4:	89 45 d4             	mov    %eax,-0x2c(%ebp)
				for (width -= strnlen(p, precision); width > 0; width--)
  8004c7:	85 ff                	test   %edi,%edi
  8004c9:	7e 11                	jle    8004dc <vprintfmt+0x1c3>
					putch(padc, putdat);
  8004cb:	83 ec 08             	sub    $0x8,%esp
  8004ce:	53                   	push   %ebx
  8004cf:	ff 75 d4             	pushl  -0x2c(%ebp)
  8004d2:	ff d6                	call   *%esi
				for (width -= strnlen(p, precision); width > 0; width--)
  8004d4:	83 ef 01             	sub    $0x1,%edi
  8004d7:	83 c4 10             	add    $0x10,%esp
  8004da:	eb eb                	jmp    8004c7 <vprintfmt+0x1ae>
  8004dc:	8b 55 c4             	mov    -0x3c(%ebp),%edx
  8004df:	85 d2                	test   %edx,%edx
  8004e1:	b8 00 00 00 00       	mov    $0x0,%eax
  8004e6:	0f 49 c2             	cmovns %edx,%eax
  8004e9:	29 c2                	sub    %eax,%edx
  8004eb:	89 55 d4             	mov    %edx,-0x2c(%ebp)
  8004ee:	eb a8                	jmp    800498 <vprintfmt+0x17f>
					putch(ch, putdat);
  8004f0:	83 ec 08             	sub    $0x8,%esp
  8004f3:	53                   	push   %ebx
  8004f4:	52                   	push   %edx
  8004f5:	ff d6                	call   *%esi
  8004f7:	83 c4 10             	add    $0x10,%esp
  8004fa:	8b 4d d4             	mov    -0x2c(%ebp),%ecx
  8004fd:	29 f9                	sub    %edi,%ecx
			for (; (ch = *p++) != '\0' && (precision < 0 || --precision >= 0); width--)
  8004ff:	83 c7 01             	add    $0x1,%edi
  800502:	0f b6 47 ff          	movzbl -0x1(%edi),%eax
  800506:	0f be d0             	movsbl %al,%edx
  800509:	85 d2                	test   %edx,%edx
  80050b:	74 4b                	je     800558 <vprintfmt+0x23f>
  80050d:	83 7d d8 00          	cmpl   $0x0,-0x28(%ebp)
  800511:	78 06                	js     800519 <vprintfmt+0x200>
  800513:	83 6d d8 01          	subl   $0x1,-0x28(%ebp)
  800517:	78 1e                	js     800537 <vprintfmt+0x21e>
				if (altflag && (ch < ' ' || ch > '~'))
  800519:	83 7d e0 00          	cmpl   $0x0,-0x20(%ebp)
  80051d:	74 d1                	je     8004f0 <vprintfmt+0x1d7>
  80051f:	0f be c0             	movsbl %al,%eax
  800522:	83 e8 20             	sub    $0x20,%eax
  800525:	83 f8 5e             	cmp    $0x5e,%eax
  800528:	76 c6                	jbe    8004f0 <vprintfmt+0x1d7>
					putch('?', putdat);
  80052a:	83 ec 08             	sub    $0x8,%esp
  80052d:	53                   	push   %ebx
  80052e:	6a 3f                	push   $0x3f
  800530:	ff d6                	call   *%esi
  800532:	83 c4 10             	add    $0x10,%esp
  800535:	eb c3                	jmp    8004fa <vprintfmt+0x1e1>
  800537:	89 cf                	mov    %ecx,%edi
  800539:	eb 0e                	jmp    800549 <vprintfmt+0x230>
				putch(' ', putdat);
  80053b:	83 ec 08             	sub    $0x8,%esp
  80053e:	53                   	push   %ebx
  80053f:	6a 20                	push   $0x20
  800541:	ff d6                	call   *%esi
			for (; width > 0; width--)
  800543:	83 ef 01             	sub    $0x1,%edi
  800546:	83 c4 10             	add    $0x10,%esp
  800549:	85 ff                	test   %edi,%edi
  80054b:	7f ee                	jg     80053b <vprintfmt+0x222>
			if ((p = va_arg(ap, char *)) == NULL)
  80054d:	8b 45 c8             	mov    -0x38(%ebp),%eax
  800550:	89 45 14             	mov    %eax,0x14(%ebp)
  800553:	e9 36 01 00 00       	jmp    80068e <vprintfmt+0x375>
  800558:	89 cf                	mov    %ecx,%edi
  80055a:	eb ed                	jmp    800549 <vprintfmt+0x230>
	if (lflag >= 2)
  80055c:	83 f9 01             	cmp    $0x1,%ecx
  80055f:	7f 1f                	jg     800580 <vprintfmt+0x267>
	else if (lflag)
  800561:	85 c9                	test   %ecx,%ecx
  800563:	74 67                	je     8005cc <vprintfmt+0x2b3>
		return va_arg(*ap, long);
  800565:	8b 45 14             	mov    0x14(%ebp),%eax
  800568:	8b 00                	mov    (%eax),%eax
  80056a:	89 45 d8             	mov    %eax,-0x28(%ebp)
  80056d:	89 c1                	mov    %eax,%ecx
  80056f:	c1 f9 1f             	sar    $0x1f,%ecx
  800572:	89 4d dc             	mov    %ecx,-0x24(%ebp)
  800575:	8b 45 14             	mov    0x14(%ebp),%eax
  800578:	8d 40 04             	lea    0x4(%eax),%eax
  80057b:	89 45 14             	mov    %eax,0x14(%ebp)
  80057e:	eb 17                	jmp    800597 <vprintfmt+0x27e>
		return va_arg(*ap, long long);
  800580:	8b 45 14             	mov    0x14(%ebp),%eax
  800583:	8b 50 04             	mov    0x4(%eax),%edx
  800586:	8b 00                	mov    (%eax),%eax
  800588:	89 45 d8             	mov    %eax,-0x28(%ebp)
  80058b:	89 55 dc             	mov    %edx,-0x24(%ebp)
  80058e:	8b 45 14             	mov    0x14(%ebp),%eax
  800591:	8d 40 08             	lea    0x8(%eax),%eax
  800594:	89 45 14             	mov    %eax,0x14(%ebp)
			if ((long long) num < 0) {
  800597:	8b 55 d8             	mov    -0x28(%ebp),%edx
  80059a:	8b 4d dc             	mov    -0x24(%ebp),%ecx
			base = 10;
  80059d:	b8 0a 00 00 00       	mov    $0xa,%eax
			if ((long long) num < 0) {
  8005a2:	85 c9                	test   %ecx,%ecx
  8005a4:	0f 89 ca 00 00 00    	jns    800674 <vprintfmt+0x35b>
				putch('-', putdat);
  8005aa:	83 ec 08             	sub    $0x8,%esp
  8005ad:	53                   	push   %ebx
  8005ae:	6a 2d                	push   $0x2d
  8005b0:	ff d6                	call   *%esi
				num = -(long long) num;
  8005b2:	8b 55 d8             	mov    -0x28(%ebp),%edx
  8005b5:	8b 4d dc             	mov    -0x24(%ebp),%ecx
  8005b8:	f7 da                	neg    %edx
  8005ba:	83 d1 00             	adc    $0x0,%ecx
  8005bd:	f7 d9                	neg    %ecx
  8005bf:	83 c4 10             	add    $0x10,%esp
			base = 10;
  8005c2:	b8 0a 00 00 00       	mov    $0xa,%eax
  8005c7:	e9 a8 00 00 00       	jmp    800674 <vprintfmt+0x35b>
		return va_arg(*ap, int);
  8005cc:	8b 45 14             	mov    0x14(%ebp),%eax
  8005cf:	8b 00                	mov    (%eax),%eax
  8005d1:	89 45 d8             	mov    %eax,-0x28(%ebp)
  8005d4:	99                   	cltd   
  8005d5:	89 55 dc             	mov    %edx,-0x24(%ebp)
  8005d8:	8b 45 14             	mov    0x14(%ebp),%eax
  8005db:	8d 40 04             	lea    0x4(%eax),%eax
  8005de:	89 45 14             	mov    %eax,0x14(%ebp)
  8005e1:	eb b4                	jmp    800597 <vprintfmt+0x27e>
	if (lflag >= 2)
  8005e3:	83 f9 01             	cmp    $0x1,%ecx
  8005e6:	7f 1b                	jg     800603 <vprintfmt+0x2ea>
	else if (lflag)
  8005e8:	85 c9                	test   %ecx,%ecx
  8005ea:	74 2c                	je     800618 <vprintfmt+0x2ff>
		return va_arg(*ap, unsigned long);
  8005ec:	8b 45 14             	mov    0x14(%ebp),%eax
  8005ef:	8b 10                	mov    (%eax),%edx
  8005f1:	b9 00 00 00 00       	mov    $0x0,%ecx
  8005f6:	8d 40 04             	lea    0x4(%eax),%eax
  8005f9:	89 45 14             	mov    %eax,0x14(%ebp)
			base = 10;
  8005fc:	b8 0a 00 00 00       	mov    $0xa,%eax
		return va_arg(*ap, unsigned long);
  800601:	eb 71                	jmp    800674 <vprintfmt+0x35b>
		return va_arg(*ap, unsigned long long);
  800603:	8b 45 14             	mov    0x14(%ebp),%eax
  800606:	8b 10                	mov    (%eax),%edx
  800608:	8b 48 04             	mov    0x4(%eax),%ecx
  80060b:	8d 40 08             	lea    0x8(%eax),%eax
  80060e:	89 45 14             	mov    %eax,0x14(%ebp)
			base = 10;
  800611:	b8 0a 00 00 00       	mov    $0xa,%eax
		return va_arg(*ap, unsigned long long);
  800616:	eb 5c                	jmp    800674 <vprintfmt+0x35b>
		return va_arg(*ap, unsigned int);
  800618:	8b 45 14             	mov    0x14(%ebp),%eax
  80061b:	8b 10                	mov    (%eax),%edx
  80061d:	b9 00 00 00 00       	mov    $0x0,%ecx
  800622:	8d 40 04             	lea    0x4(%eax),%eax
  800625:	89 45 14             	mov    %eax,0x14(%ebp)
			base = 10;
  800628:	b8 0a 00 00 00       	mov    $0xa,%eax
		return va_arg(*ap, unsigned int);
  80062d:	eb 45                	jmp    800674 <vprintfmt+0x35b>
			putch('X', putdat);
  80062f:	83 ec 08             	sub    $0x8,%esp
  800632:	53                   	push   %ebx
  800633:	6a 58                	push   $0x58
  800635:	ff d6                	call   *%esi
			putch('X', putdat);
  800637:	83 c4 08             	add    $0x8,%esp
  80063a:	53                   	push   %ebx
  80063b:	6a 58                	push   $0x58
  80063d:	ff d6                	call   *%esi
			putch('X', putdat);
  80063f:	83 c4 08             	add    $0x8,%esp
  800642:	53                   	push   %ebx
  800643:	6a 58                	push   $0x58
  800645:	ff d6                	call   *%esi
			break;
  800647:	83 c4 10             	add    $0x10,%esp
  80064a:	eb 42                	jmp    80068e <vprintfmt+0x375>
			putch('0', putdat);
  80064c:	83 ec 08             	sub    $0x8,%esp
  80064f:	53                   	push   %ebx
  800650:	6a 30                	push   $0x30
  800652:	ff d6                	call   *%esi
			putch('x', putdat);
  800654:	83 c4 08             	add    $0x8,%esp
  800657:	53                   	push   %ebx
  800658:	6a 78                	push   $0x78
  80065a:	ff d6                	call   *%esi
			num = (unsigned long long)
  80065c:	8b 45 14             	mov    0x14(%ebp),%eax
  80065f:	8b 10                	mov    (%eax),%edx
  800661:	b9 00 00 00 00       	mov    $0x0,%ecx
			goto number;
  800666:	83 c4 10             	add    $0x10,%esp
				(uintptr_t) va_arg(ap, void *);
  800669:	8d 40 04             	lea    0x4(%eax),%eax
  80066c:	89 45 14             	mov    %eax,0x14(%ebp)
			base = 16;
  80066f:	b8 10 00 00 00       	mov    $0x10,%eax
			printnum(putch, putdat, num, base, width, padc);
  800674:	83 ec 0c             	sub    $0xc,%esp
  800677:	0f be 7d d3          	movsbl -0x2d(%ebp),%edi
  80067b:	57                   	push   %edi
  80067c:	ff 75 d4             	pushl  -0x2c(%ebp)
  80067f:	50                   	push   %eax
  800680:	51                   	push   %ecx
  800681:	52                   	push   %edx
  800682:	89 da                	mov    %ebx,%edx
  800684:	89 f0                	mov    %esi,%eax
  800686:	e8 a3 fb ff ff       	call   80022e <printnum>
			break;
  80068b:	83 c4 20             	add    $0x20,%esp
			if ((p = va_arg(ap, char *)) == NULL)
  80068e:	8b 7d e4             	mov    -0x1c(%ebp),%edi
		while ((ch = *(unsigned char *) fmt++) != '%') {
  800691:	83 c7 01             	add    $0x1,%edi
  800694:	0f b6 47 ff          	movzbl -0x1(%edi),%eax
  800698:	83 f8 25             	cmp    $0x25,%eax
  80069b:	0f 84 93 fc ff ff    	je     800334 <vprintfmt+0x1b>
			if (ch == '\0')
  8006a1:	85 c0                	test   %eax,%eax
  8006a3:	0f 84 8b 00 00 00    	je     800734 <vprintfmt+0x41b>
			putch(ch, putdat);
  8006a9:	83 ec 08             	sub    $0x8,%esp
  8006ac:	53                   	push   %ebx
  8006ad:	50                   	push   %eax
  8006ae:	ff d6                	call   *%esi
  8006b0:	83 c4 10             	add    $0x10,%esp
  8006b3:	eb dc                	jmp    800691 <vprintfmt+0x378>
	if (lflag >= 2)
  8006b5:	83 f9 01             	cmp    $0x1,%ecx
  8006b8:	7f 1b                	jg     8006d5 <vprintfmt+0x3bc>
	else if (lflag)
  8006ba:	85 c9                	test   %ecx,%ecx
  8006bc:	74 2c                	je     8006ea <vprintfmt+0x3d1>
		return va_arg(*ap, unsigned long);
  8006be:	8b 45 14             	mov    0x14(%ebp),%eax
  8006c1:	8b 10                	mov    (%eax),%edx
  8006c3:	b9 00 00 00 00       	mov    $0x0,%ecx
  8006c8:	8d 40 04             	lea    0x4(%eax),%eax
  8006cb:	89 45 14             	mov    %eax,0x14(%ebp)
			base = 16;
  8006ce:	b8 10 00 00 00       	mov    $0x10,%eax
		return va_arg(*ap, unsigned long);
  8006d3:	eb 9f                	jmp    800674 <vprintfmt+0x35b>
		return va_arg(*ap, unsigned long long);
  8006d5:	8b 45 14             	mov    0x14(%ebp),%eax
  8006d8:	8b 10                	mov    (%eax),%edx
  8006da:	8b 48 04             	mov    0x4(%eax),%ecx
  8006dd:	8d 40 08             	lea    0x8(%eax),%eax
  8006e0:	89 45 14             	mov    %eax,0x14(%ebp)
			base = 16;
  8006e3:	b8 10 00 00 00       	mov    $0x10,%eax
		return va_arg(*ap, unsigned long long);
  8006e8:	eb 8a                	jmp    800674 <vprintfmt+0x35b>
		return va_arg(*ap, unsigned int);
  8006ea:	8b 45 14             	mov    0x14(%ebp),%eax
  8006ed:	8b 10                	mov    (%eax),%edx
  8006ef:	b9 00 00 00 00       	mov    $0x0,%ecx
  8006f4:	8d 40 04             	lea    0x4(%eax),%eax
  8006f7:	89 45 14             	mov    %eax,0x14(%ebp)
			base = 16;
  8006fa:	b8 10 00 00 00       	mov    $0x10,%eax
		return va_arg(*ap, unsigned int);
  8006ff:	e9 70 ff ff ff       	jmp    800674 <vprintfmt+0x35b>
			putch(ch, putdat);
  800704:	83 ec 08             	sub    $0x8,%esp
  800707:	53                   	push   %ebx
  800708:	6a 25                	push   $0x25
  80070a:	ff d6                	call   *%esi
			break;
  80070c:	83 c4 10             	add    $0x10,%esp
  80070f:	e9 7a ff ff ff       	jmp    80068e <vprintfmt+0x375>
			putch('%', putdat);
  800714:	83 ec 08             	sub    $0x8,%esp
  800717:	53                   	push   %ebx
  800718:	6a 25                	push   $0x25
  80071a:	ff d6                	call   *%esi
			for (fmt--; fmt[-1] != '%'; fmt--)
  80071c:	83 c4 10             	add    $0x10,%esp
  80071f:	89 f8                	mov    %edi,%eax
  800721:	80 78 ff 25          	cmpb   $0x25,-0x1(%eax)
  800725:	74 05                	je     80072c <vprintfmt+0x413>
  800727:	83 e8 01             	sub    $0x1,%eax
  80072a:	eb f5                	jmp    800721 <vprintfmt+0x408>
  80072c:	89 45 e4             	mov    %eax,-0x1c(%ebp)
  80072f:	e9 5a ff ff ff       	jmp    80068e <vprintfmt+0x375>
}
  800734:	8d 65 f4             	lea    -0xc(%ebp),%esp
  800737:	5b                   	pop    %ebx
  800738:	5e                   	pop    %esi
  800739:	5f                   	pop    %edi
  80073a:	5d                   	pop    %ebp
  80073b:	c3                   	ret    

0080073c <vsnprintf>:

int
vsnprintf(char *buf, int n, const char *fmt, va_list ap)
{
  80073c:	f3 0f 1e fb          	endbr32 
  800740:	55                   	push   %ebp
  800741:	89 e5                	mov    %esp,%ebp
  800743:	83 ec 18             	sub    $0x18,%esp
  800746:	8b 45 08             	mov    0x8(%ebp),%eax
  800749:	8b 55 0c             	mov    0xc(%ebp),%edx
	struct sprintbuf b = {buf, buf+n-1, 0};
  80074c:	89 45 ec             	mov    %eax,-0x14(%ebp)
  80074f:	8d 4c 10 ff          	lea    -0x1(%eax,%edx,1),%ecx
  800753:	89 4d f0             	mov    %ecx,-0x10(%ebp)
  800756:	c7 45 f4 00 00 00 00 	movl   $0x0,-0xc(%ebp)

	if (buf == NULL || n < 1)
  80075d:	85 c0                	test   %eax,%eax
  80075f:	74 26                	je     800787 <vsnprintf+0x4b>
  800761:	85 d2                	test   %edx,%edx
  800763:	7e 22                	jle    800787 <vsnprintf+0x4b>
		return -E_INVAL;

	// print the string to the buffer
	vprintfmt((void*)sprintputch, &b, fmt, ap);
  800765:	ff 75 14             	pushl  0x14(%ebp)
  800768:	ff 75 10             	pushl  0x10(%ebp)
  80076b:	8d 45 ec             	lea    -0x14(%ebp),%eax
  80076e:	50                   	push   %eax
  80076f:	68 d7 02 80 00       	push   $0x8002d7
  800774:	e8 a0 fb ff ff       	call   800319 <vprintfmt>

	// null terminate the buffer
	*b.buf = '\0';
  800779:	8b 45 ec             	mov    -0x14(%ebp),%eax
  80077c:	c6 00 00             	movb   $0x0,(%eax)

	return b.cnt;
  80077f:	8b 45 f4             	mov    -0xc(%ebp),%eax
  800782:	83 c4 10             	add    $0x10,%esp
}
  800785:	c9                   	leave  
  800786:	c3                   	ret    
		return -E_INVAL;
  800787:	b8 fd ff ff ff       	mov    $0xfffffffd,%eax
  80078c:	eb f7                	jmp    800785 <vsnprintf+0x49>

0080078e <snprintf>:

int
snprintf(char *buf, int n, const char *fmt, ...)
{
  80078e:	f3 0f 1e fb          	endbr32 
  800792:	55                   	push   %ebp
  800793:	89 e5                	mov    %esp,%ebp
  800795:	83 ec 08             	sub    $0x8,%esp
	va_list ap;
	int rc;

	va_start(ap, fmt);
  800798:	8d 45 14             	lea    0x14(%ebp),%eax
	rc = vsnprintf(buf, n, fmt, ap);
  80079b:	50                   	push   %eax
  80079c:	ff 75 10             	pushl  0x10(%ebp)
  80079f:	ff 75 0c             	pushl  0xc(%ebp)
  8007a2:	ff 75 08             	pushl  0x8(%ebp)
  8007a5:	e8 92 ff ff ff       	call   80073c <vsnprintf>
	va_end(ap);

	return rc;
}
  8007aa:	c9                   	leave  
  8007ab:	c3                   	ret    

008007ac <strlen>:
// Primespipe runs 3x faster this way.
#define ASM 1

int
strlen(const char *s)
{
  8007ac:	f3 0f 1e fb          	endbr32 
  8007b0:	55                   	push   %ebp
  8007b1:	89 e5                	mov    %esp,%ebp
  8007b3:	8b 55 08             	mov    0x8(%ebp),%edx
	int n;

	for (n = 0; *s != '\0'; s++)
  8007b6:	b8 00 00 00 00       	mov    $0x0,%eax
  8007bb:	80 3c 02 00          	cmpb   $0x0,(%edx,%eax,1)
  8007bf:	74 05                	je     8007c6 <strlen+0x1a>
		n++;
  8007c1:	83 c0 01             	add    $0x1,%eax
  8007c4:	eb f5                	jmp    8007bb <strlen+0xf>
	return n;
}
  8007c6:	5d                   	pop    %ebp
  8007c7:	c3                   	ret    

008007c8 <strnlen>:

int
strnlen(const char *s, size_t size)
{
  8007c8:	f3 0f 1e fb          	endbr32 
  8007cc:	55                   	push   %ebp
  8007cd:	89 e5                	mov    %esp,%ebp
  8007cf:	8b 4d 08             	mov    0x8(%ebp),%ecx
  8007d2:	8b 55 0c             	mov    0xc(%ebp),%edx
	int n;

	for (n = 0; size > 0 && *s != '\0'; s++, size--)
  8007d5:	b8 00 00 00 00       	mov    $0x0,%eax
  8007da:	39 d0                	cmp    %edx,%eax
  8007dc:	74 0d                	je     8007eb <strnlen+0x23>
  8007de:	80 3c 01 00          	cmpb   $0x0,(%ecx,%eax,1)
  8007e2:	74 05                	je     8007e9 <strnlen+0x21>
		n++;
  8007e4:	83 c0 01             	add    $0x1,%eax
  8007e7:	eb f1                	jmp    8007da <strnlen+0x12>
  8007e9:	89 c2                	mov    %eax,%edx
	return n;
}
  8007eb:	89 d0                	mov    %edx,%eax
  8007ed:	5d                   	pop    %ebp
  8007ee:	c3                   	ret    

008007ef <strcpy>:

char *
strcpy(char *dst, const char *src)
{
  8007ef:	f3 0f 1e fb          	endbr32 
  8007f3:	55                   	push   %ebp
  8007f4:	89 e5                	mov    %esp,%ebp
  8007f6:	53                   	push   %ebx
  8007f7:	8b 4d 08             	mov    0x8(%ebp),%ecx
  8007fa:	8b 5d 0c             	mov    0xc(%ebp),%ebx
	char *ret;

	ret = dst;
	while ((*dst++ = *src++) != '\0')
  8007fd:	b8 00 00 00 00       	mov    $0x0,%eax
  800802:	0f b6 14 03          	movzbl (%ebx,%eax,1),%edx
  800806:	88 14 01             	mov    %dl,(%ecx,%eax,1)
  800809:	83 c0 01             	add    $0x1,%eax
  80080c:	84 d2                	test   %dl,%dl
  80080e:	75 f2                	jne    800802 <strcpy+0x13>
		/* do nothing */;
	return ret;
}
  800810:	89 c8                	mov    %ecx,%eax
  800812:	5b                   	pop    %ebx
  800813:	5d                   	pop    %ebp
  800814:	c3                   	ret    

00800815 <strcat>:

char *
strcat(char *dst, const char *src)
{
  800815:	f3 0f 1e fb          	endbr32 
  800819:	55                   	push   %ebp
  80081a:	89 e5                	mov    %esp,%ebp
  80081c:	53                   	push   %ebx
  80081d:	83 ec 10             	sub    $0x10,%esp
  800820:	8b 5d 08             	mov    0x8(%ebp),%ebx
	int len = strlen(dst);
  800823:	53                   	push   %ebx
  800824:	e8 83 ff ff ff       	call   8007ac <strlen>
  800829:	83 c4 08             	add    $0x8,%esp
	strcpy(dst + len, src);
  80082c:	ff 75 0c             	pushl  0xc(%ebp)
  80082f:	01 d8                	add    %ebx,%eax
  800831:	50                   	push   %eax
  800832:	e8 b8 ff ff ff       	call   8007ef <strcpy>
	return dst;
}
  800837:	89 d8                	mov    %ebx,%eax
  800839:	8b 5d fc             	mov    -0x4(%ebp),%ebx
  80083c:	c9                   	leave  
  80083d:	c3                   	ret    

0080083e <strncpy>:

char *
strncpy(char *dst, const char *src, size_t size) {
  80083e:	f3 0f 1e fb          	endbr32 
  800842:	55                   	push   %ebp
  800843:	89 e5                	mov    %esp,%ebp
  800845:	56                   	push   %esi
  800846:	53                   	push   %ebx
  800847:	8b 75 08             	mov    0x8(%ebp),%esi
  80084a:	8b 55 0c             	mov    0xc(%ebp),%edx
  80084d:	89 f3                	mov    %esi,%ebx
  80084f:	03 5d 10             	add    0x10(%ebp),%ebx
	size_t i;
	char *ret;

	ret = dst;
	for (i = 0; i < size; i++) {
  800852:	89 f0                	mov    %esi,%eax
  800854:	39 d8                	cmp    %ebx,%eax
  800856:	74 11                	je     800869 <strncpy+0x2b>
		*dst++ = *src;
  800858:	83 c0 01             	add    $0x1,%eax
  80085b:	0f b6 0a             	movzbl (%edx),%ecx
  80085e:	88 48 ff             	mov    %cl,-0x1(%eax)
		// If strlen(src) < size, null-pad 'dst' out to 'size' chars
		if (*src != '\0')
			src++;
  800861:	80 f9 01             	cmp    $0x1,%cl
  800864:	83 da ff             	sbb    $0xffffffff,%edx
  800867:	eb eb                	jmp    800854 <strncpy+0x16>
	}
	return ret;
}
  800869:	89 f0                	mov    %esi,%eax
  80086b:	5b                   	pop    %ebx
  80086c:	5e                   	pop    %esi
  80086d:	5d                   	pop    %ebp
  80086e:	c3                   	ret    

0080086f <strlcpy>:

size_t
strlcpy(char *dst, const char *src, size_t size)
{
  80086f:	f3 0f 1e fb          	endbr32 
  800873:	55                   	push   %ebp
  800874:	89 e5                	mov    %esp,%ebp
  800876:	56                   	push   %esi
  800877:	53                   	push   %ebx
  800878:	8b 75 08             	mov    0x8(%ebp),%esi
  80087b:	8b 4d 0c             	mov    0xc(%ebp),%ecx
  80087e:	8b 55 10             	mov    0x10(%ebp),%edx
  800881:	89 f0                	mov    %esi,%eax
	char *dst_in;

	dst_in = dst;
	if (size > 0) {
  800883:	85 d2                	test   %edx,%edx
  800885:	74 21                	je     8008a8 <strlcpy+0x39>
  800887:	8d 44 16 ff          	lea    -0x1(%esi,%edx,1),%eax
  80088b:	89 f2                	mov    %esi,%edx
		while (--size > 0 && *src != '\0')
  80088d:	39 c2                	cmp    %eax,%edx
  80088f:	74 14                	je     8008a5 <strlcpy+0x36>
  800891:	0f b6 19             	movzbl (%ecx),%ebx
  800894:	84 db                	test   %bl,%bl
  800896:	74 0b                	je     8008a3 <strlcpy+0x34>
			*dst++ = *src++;
  800898:	83 c1 01             	add    $0x1,%ecx
  80089b:	83 c2 01             	add    $0x1,%edx
  80089e:	88 5a ff             	mov    %bl,-0x1(%edx)
  8008a1:	eb ea                	jmp    80088d <strlcpy+0x1e>
  8008a3:	89 d0                	mov    %edx,%eax
		*dst = '\0';
  8008a5:	c6 00 00             	movb   $0x0,(%eax)
	}
	return dst - dst_in;
  8008a8:	29 f0                	sub    %esi,%eax
}
  8008aa:	5b                   	pop    %ebx
  8008ab:	5e                   	pop    %esi
  8008ac:	5d                   	pop    %ebp
  8008ad:	c3                   	ret    

008008ae <strcmp>:

int
strcmp(const char *p, const char *q)
{
  8008ae:	f3 0f 1e fb          	endbr32 
  8008b2:	55                   	push   %ebp
  8008b3:	89 e5                	mov    %esp,%ebp
  8008b5:	8b 4d 08             	mov    0x8(%ebp),%ecx
  8008b8:	8b 55 0c             	mov    0xc(%ebp),%edx
	while (*p && *p == *q)
  8008bb:	0f b6 01             	movzbl (%ecx),%eax
  8008be:	84 c0                	test   %al,%al
  8008c0:	74 0c                	je     8008ce <strcmp+0x20>
  8008c2:	3a 02                	cmp    (%edx),%al
  8008c4:	75 08                	jne    8008ce <strcmp+0x20>
		p++, q++;
  8008c6:	83 c1 01             	add    $0x1,%ecx
  8008c9:	83 c2 01             	add    $0x1,%edx
  8008cc:	eb ed                	jmp    8008bb <strcmp+0xd>
	return (int) ((unsigned char) *p - (unsigned char) *q);
  8008ce:	0f b6 c0             	movzbl %al,%eax
  8008d1:	0f b6 12             	movzbl (%edx),%edx
  8008d4:	29 d0                	sub    %edx,%eax
}
  8008d6:	5d                   	pop    %ebp
  8008d7:	c3                   	ret    

008008d8 <strncmp>:

int
strncmp(const char *p, const char *q, size_t n)
{
  8008d8:	f3 0f 1e fb          	endbr32 
  8008dc:	55                   	push   %ebp
  8008dd:	89 e5                	mov    %esp,%ebp
  8008df:	53                   	push   %ebx
  8008e0:	8b 45 08             	mov    0x8(%ebp),%eax
  8008e3:	8b 55 0c             	mov    0xc(%ebp),%edx
  8008e6:	89 c3                	mov    %eax,%ebx
  8008e8:	03 5d 10             	add    0x10(%ebp),%ebx
	while (n > 0 && *p && *p == *q)
  8008eb:	eb 06                	jmp    8008f3 <strncmp+0x1b>
		n--, p++, q++;
  8008ed:	83 c0 01             	add    $0x1,%eax
  8008f0:	83 c2 01             	add    $0x1,%edx
	while (n > 0 && *p && *p == *q)
  8008f3:	39 d8                	cmp    %ebx,%eax
  8008f5:	74 16                	je     80090d <strncmp+0x35>
  8008f7:	0f b6 08             	movzbl (%eax),%ecx
  8008fa:	84 c9                	test   %cl,%cl
  8008fc:	74 04                	je     800902 <strncmp+0x2a>
  8008fe:	3a 0a                	cmp    (%edx),%cl
  800900:	74 eb                	je     8008ed <strncmp+0x15>
	if (n == 0)
		return 0;
	else
		return (int) ((unsigned char) *p - (unsigned char) *q);
  800902:	0f b6 00             	movzbl (%eax),%eax
  800905:	0f b6 12             	movzbl (%edx),%edx
  800908:	29 d0                	sub    %edx,%eax
}
  80090a:	5b                   	pop    %ebx
  80090b:	5d                   	pop    %ebp
  80090c:	c3                   	ret    
		return 0;
  80090d:	b8 00 00 00 00       	mov    $0x0,%eax
  800912:	eb f6                	jmp    80090a <strncmp+0x32>

00800914 <strchr>:

// Return a pointer to the first occurrence of 'c' in 's',
// or a null pointer if the string has no 'c'.
char *
strchr(const char *s, char c)
{
  800914:	f3 0f 1e fb          	endbr32 
  800918:	55                   	push   %ebp
  800919:	89 e5                	mov    %esp,%ebp
  80091b:	8b 45 08             	mov    0x8(%ebp),%eax
  80091e:	0f b6 4d 0c          	movzbl 0xc(%ebp),%ecx
	for (; *s; s++)
  800922:	0f b6 10             	movzbl (%eax),%edx
  800925:	84 d2                	test   %dl,%dl
  800927:	74 09                	je     800932 <strchr+0x1e>
		if (*s == c)
  800929:	38 ca                	cmp    %cl,%dl
  80092b:	74 0a                	je     800937 <strchr+0x23>
	for (; *s; s++)
  80092d:	83 c0 01             	add    $0x1,%eax
  800930:	eb f0                	jmp    800922 <strchr+0xe>
			return (char *) s;
	return 0;
  800932:	b8 00 00 00 00       	mov    $0x0,%eax
}
  800937:	5d                   	pop    %ebp
  800938:	c3                   	ret    

00800939 <strfind>:

// Return a pointer to the first occurrence of 'c' in 's',
// or a pointer to the string-ending null character if the string has no 'c'.
char *
strfind(const char *s, char c)
{
  800939:	f3 0f 1e fb          	endbr32 
  80093d:	55                   	push   %ebp
  80093e:	89 e5                	mov    %esp,%ebp
  800940:	8b 45 08             	mov    0x8(%ebp),%eax
  800943:	0f b6 4d 0c          	movzbl 0xc(%ebp),%ecx
	for (; *s; s++)
  800947:	0f b6 10             	movzbl (%eax),%edx
		if (*s == c)
  80094a:	38 ca                	cmp    %cl,%dl
  80094c:	74 09                	je     800957 <strfind+0x1e>
  80094e:	84 d2                	test   %dl,%dl
  800950:	74 05                	je     800957 <strfind+0x1e>
	for (; *s; s++)
  800952:	83 c0 01             	add    $0x1,%eax
  800955:	eb f0                	jmp    800947 <strfind+0xe>
			break;
	return (char *) s;
}
  800957:	5d                   	pop    %ebp
  800958:	c3                   	ret    

00800959 <memset>:

#if ASM
void *
memset(void *v, int c, size_t n)
{
  800959:	f3 0f 1e fb          	endbr32 
  80095d:	55                   	push   %ebp
  80095e:	89 e5                	mov    %esp,%ebp
  800960:	57                   	push   %edi
  800961:	56                   	push   %esi
  800962:	53                   	push   %ebx
  800963:	8b 7d 08             	mov    0x8(%ebp),%edi
  800966:	8b 4d 10             	mov    0x10(%ebp),%ecx
	char *p;

	if (n == 0)
  800969:	85 c9                	test   %ecx,%ecx
  80096b:	74 31                	je     80099e <memset+0x45>
		return v;
	if ((int)v%4 == 0 && n%4 == 0) {
  80096d:	89 f8                	mov    %edi,%eax
  80096f:	09 c8                	or     %ecx,%eax
  800971:	a8 03                	test   $0x3,%al
  800973:	75 23                	jne    800998 <memset+0x3f>
		c &= 0xFF;
  800975:	0f b6 55 0c          	movzbl 0xc(%ebp),%edx
		c = (c<<24)|(c<<16)|(c<<8)|c;
  800979:	89 d3                	mov    %edx,%ebx
  80097b:	c1 e3 08             	shl    $0x8,%ebx
  80097e:	89 d0                	mov    %edx,%eax
  800980:	c1 e0 18             	shl    $0x18,%eax
  800983:	89 d6                	mov    %edx,%esi
  800985:	c1 e6 10             	shl    $0x10,%esi
  800988:	09 f0                	or     %esi,%eax
  80098a:	09 c2                	or     %eax,%edx
  80098c:	09 da                	or     %ebx,%edx
		asm volatile("cld; rep stosl\n"
			:: "D" (v), "a" (c), "c" (n/4)
  80098e:	c1 e9 02             	shr    $0x2,%ecx
		asm volatile("cld; rep stosl\n"
  800991:	89 d0                	mov    %edx,%eax
  800993:	fc                   	cld    
  800994:	f3 ab                	rep stos %eax,%es:(%edi)
  800996:	eb 06                	jmp    80099e <memset+0x45>
			: "cc", "memory");
	} else
		asm volatile("cld; rep stosb\n"
  800998:	8b 45 0c             	mov    0xc(%ebp),%eax
  80099b:	fc                   	cld    
  80099c:	f3 aa                	rep stos %al,%es:(%edi)
			:: "D" (v), "a" (c), "c" (n)
			: "cc", "memory");
	return v;
}
  80099e:	89 f8                	mov    %edi,%eax
  8009a0:	5b                   	pop    %ebx
  8009a1:	5e                   	pop    %esi
  8009a2:	5f                   	pop    %edi
  8009a3:	5d                   	pop    %ebp
  8009a4:	c3                   	ret    

008009a5 <memmove>:

void *
memmove(void *dst, const void *src, size_t n)
{
  8009a5:	f3 0f 1e fb          	endbr32 
  8009a9:	55                   	push   %ebp
  8009aa:	89 e5                	mov    %esp,%ebp
  8009ac:	57                   	push   %edi
  8009ad:	56                   	push   %esi
  8009ae:	8b 45 08             	mov    0x8(%ebp),%eax
  8009b1:	8b 75 0c             	mov    0xc(%ebp),%esi
  8009b4:	8b 4d 10             	mov    0x10(%ebp),%ecx
	const char *s;
	char *d;

	s = src;
	d = dst;
	if (s < d && s + n > d) {
  8009b7:	39 c6                	cmp    %eax,%esi
  8009b9:	73 32                	jae    8009ed <memmove+0x48>
  8009bb:	8d 14 0e             	lea    (%esi,%ecx,1),%edx
  8009be:	39 c2                	cmp    %eax,%edx
  8009c0:	76 2b                	jbe    8009ed <memmove+0x48>
		s += n;
		d += n;
  8009c2:	8d 3c 08             	lea    (%eax,%ecx,1),%edi
		if ((int)s%4 == 0 && (int)d%4 == 0 && n%4 == 0)
  8009c5:	89 fe                	mov    %edi,%esi
  8009c7:	09 ce                	or     %ecx,%esi
  8009c9:	09 d6                	or     %edx,%esi
  8009cb:	f7 c6 03 00 00 00    	test   $0x3,%esi
  8009d1:	75 0e                	jne    8009e1 <memmove+0x3c>
			asm volatile("std; rep movsl\n"
				:: "D" (d-4), "S" (s-4), "c" (n/4) : "cc", "memory");
  8009d3:	83 ef 04             	sub    $0x4,%edi
  8009d6:	8d 72 fc             	lea    -0x4(%edx),%esi
  8009d9:	c1 e9 02             	shr    $0x2,%ecx
			asm volatile("std; rep movsl\n"
  8009dc:	fd                   	std    
  8009dd:	f3 a5                	rep movsl %ds:(%esi),%es:(%edi)
  8009df:	eb 09                	jmp    8009ea <memmove+0x45>
		else
			asm volatile("std; rep movsb\n"
				:: "D" (d-1), "S" (s-1), "c" (n) : "cc", "memory");
  8009e1:	83 ef 01             	sub    $0x1,%edi
  8009e4:	8d 72 ff             	lea    -0x1(%edx),%esi
			asm volatile("std; rep movsb\n"
  8009e7:	fd                   	std    
  8009e8:	f3 a4                	rep movsb %ds:(%esi),%es:(%edi)
		// Some versions of GCC rely on DF being clear
		asm volatile("cld" ::: "cc");
  8009ea:	fc                   	cld    
  8009eb:	eb 1a                	jmp    800a07 <memmove+0x62>
	} else {
		if ((int)s%4 == 0 && (int)d%4 == 0 && n%4 == 0)
  8009ed:	89 c2                	mov    %eax,%edx
  8009ef:	09 ca                	or     %ecx,%edx
  8009f1:	09 f2                	or     %esi,%edx
  8009f3:	f6 c2 03             	test   $0x3,%dl
  8009f6:	75 0a                	jne    800a02 <memmove+0x5d>
			asm volatile("cld; rep movsl\n"
				:: "D" (d), "S" (s), "c" (n/4) : "cc", "memory");
  8009f8:	c1 e9 02             	shr    $0x2,%ecx
			asm volatile("cld; rep movsl\n"
  8009fb:	89 c7                	mov    %eax,%edi
  8009fd:	fc                   	cld    
  8009fe:	f3 a5                	rep movsl %ds:(%esi),%es:(%edi)
  800a00:	eb 05                	jmp    800a07 <memmove+0x62>
		else
			asm volatile("cld; rep movsb\n"
  800a02:	89 c7                	mov    %eax,%edi
  800a04:	fc                   	cld    
  800a05:	f3 a4                	rep movsb %ds:(%esi),%es:(%edi)
				:: "D" (d), "S" (s), "c" (n) : "cc", "memory");
	}
	return dst;
}
  800a07:	5e                   	pop    %esi
  800a08:	5f                   	pop    %edi
  800a09:	5d                   	pop    %ebp
  800a0a:	c3                   	ret    

00800a0b <memcpy>:
}
#endif

void *
memcpy(void *dst, const void *src, size_t n)
{
  800a0b:	f3 0f 1e fb          	endbr32 
  800a0f:	55                   	push   %ebp
  800a10:	89 e5                	mov    %esp,%ebp
  800a12:	83 ec 0c             	sub    $0xc,%esp
	return memmove(dst, src, n);
  800a15:	ff 75 10             	pushl  0x10(%ebp)
  800a18:	ff 75 0c             	pushl  0xc(%ebp)
  800a1b:	ff 75 08             	pushl  0x8(%ebp)
  800a1e:	e8 82 ff ff ff       	call   8009a5 <memmove>
}
  800a23:	c9                   	leave  
  800a24:	c3                   	ret    

00800a25 <memcmp>:

int
memcmp(const void *v1, const void *v2, size_t n)
{
  800a25:	f3 0f 1e fb          	endbr32 
  800a29:	55                   	push   %ebp
  800a2a:	89 e5                	mov    %esp,%ebp
  800a2c:	56                   	push   %esi
  800a2d:	53                   	push   %ebx
  800a2e:	8b 45 08             	mov    0x8(%ebp),%eax
  800a31:	8b 55 0c             	mov    0xc(%ebp),%edx
  800a34:	89 c6                	mov    %eax,%esi
  800a36:	03 75 10             	add    0x10(%ebp),%esi
	const uint8_t *s1 = (const uint8_t *) v1;
	const uint8_t *s2 = (const uint8_t *) v2;

	while (n-- > 0) {
  800a39:	39 f0                	cmp    %esi,%eax
  800a3b:	74 1c                	je     800a59 <memcmp+0x34>
		if (*s1 != *s2)
  800a3d:	0f b6 08             	movzbl (%eax),%ecx
  800a40:	0f b6 1a             	movzbl (%edx),%ebx
  800a43:	38 d9                	cmp    %bl,%cl
  800a45:	75 08                	jne    800a4f <memcmp+0x2a>
			return (int) *s1 - (int) *s2;
		s1++, s2++;
  800a47:	83 c0 01             	add    $0x1,%eax
  800a4a:	83 c2 01             	add    $0x1,%edx
  800a4d:	eb ea                	jmp    800a39 <memcmp+0x14>
			return (int) *s1 - (int) *s2;
  800a4f:	0f b6 c1             	movzbl %cl,%eax
  800a52:	0f b6 db             	movzbl %bl,%ebx
  800a55:	29 d8                	sub    %ebx,%eax
  800a57:	eb 05                	jmp    800a5e <memcmp+0x39>
	}

	return 0;
  800a59:	b8 00 00 00 00       	mov    $0x0,%eax
}
  800a5e:	5b                   	pop    %ebx
  800a5f:	5e                   	pop    %esi
  800a60:	5d                   	pop    %ebp
  800a61:	c3                   	ret    

00800a62 <memfind>:

void *
memfind(const void *s, int c, size_t n)
{
  800a62:	f3 0f 1e fb          	endbr32 
  800a66:	55                   	push   %ebp
  800a67:	89 e5                	mov    %esp,%ebp
  800a69:	8b 45 08             	mov    0x8(%ebp),%eax
  800a6c:	8b 4d 0c             	mov    0xc(%ebp),%ecx
	const void *ends = (const char *) s + n;
  800a6f:	89 c2                	mov    %eax,%edx
  800a71:	03 55 10             	add    0x10(%ebp),%edx
	for (; s < ends; s++)
  800a74:	39 d0                	cmp    %edx,%eax
  800a76:	73 09                	jae    800a81 <memfind+0x1f>
		if (*(const unsigned char *) s == (unsigned char) c)
  800a78:	38 08                	cmp    %cl,(%eax)
  800a7a:	74 05                	je     800a81 <memfind+0x1f>
	for (; s < ends; s++)
  800a7c:	83 c0 01             	add    $0x1,%eax
  800a7f:	eb f3                	jmp    800a74 <memfind+0x12>
			break;
	return (void *) s;
}
  800a81:	5d                   	pop    %ebp
  800a82:	c3                   	ret    

00800a83 <strtol>:

long
strtol(const char *s, char **endptr, int base)
{
  800a83:	f3 0f 1e fb          	endbr32 
  800a87:	55                   	push   %ebp
  800a88:	89 e5                	mov    %esp,%ebp
  800a8a:	57                   	push   %edi
  800a8b:	56                   	push   %esi
  800a8c:	53                   	push   %ebx
  800a8d:	8b 4d 08             	mov    0x8(%ebp),%ecx
  800a90:	8b 5d 10             	mov    0x10(%ebp),%ebx
	int neg = 0;
	long val = 0;

	// gobble initial whitespace
	while (*s == ' ' || *s == '\t')
  800a93:	eb 03                	jmp    800a98 <strtol+0x15>
		s++;
  800a95:	83 c1 01             	add    $0x1,%ecx
	while (*s == ' ' || *s == '\t')
  800a98:	0f b6 01             	movzbl (%ecx),%eax
  800a9b:	3c 20                	cmp    $0x20,%al
  800a9d:	74 f6                	je     800a95 <strtol+0x12>
  800a9f:	3c 09                	cmp    $0x9,%al
  800aa1:	74 f2                	je     800a95 <strtol+0x12>

	// plus/minus sign
	if (*s == '+')
  800aa3:	3c 2b                	cmp    $0x2b,%al
  800aa5:	74 2a                	je     800ad1 <strtol+0x4e>
	int neg = 0;
  800aa7:	bf 00 00 00 00       	mov    $0x0,%edi
		s++;
	else if (*s == '-')
  800aac:	3c 2d                	cmp    $0x2d,%al
  800aae:	74 2b                	je     800adb <strtol+0x58>
		s++, neg = 1;

	// hex or octal base prefix
	if ((base == 0 || base == 16) && (s[0] == '0' && s[1] == 'x'))
  800ab0:	f7 c3 ef ff ff ff    	test   $0xffffffef,%ebx
  800ab6:	75 0f                	jne    800ac7 <strtol+0x44>
  800ab8:	80 39 30             	cmpb   $0x30,(%ecx)
  800abb:	74 28                	je     800ae5 <strtol+0x62>
		s += 2, base = 16;
	else if (base == 0 && s[0] == '0')
		s++, base = 8;
	else if (base == 0)
		base = 10;
  800abd:	85 db                	test   %ebx,%ebx
  800abf:	b8 0a 00 00 00       	mov    $0xa,%eax
  800ac4:	0f 44 d8             	cmove  %eax,%ebx
  800ac7:	b8 00 00 00 00       	mov    $0x0,%eax
  800acc:	89 5d 10             	mov    %ebx,0x10(%ebp)
  800acf:	eb 46                	jmp    800b17 <strtol+0x94>
		s++;
  800ad1:	83 c1 01             	add    $0x1,%ecx
	int neg = 0;
  800ad4:	bf 00 00 00 00       	mov    $0x0,%edi
  800ad9:	eb d5                	jmp    800ab0 <strtol+0x2d>
		s++, neg = 1;
  800adb:	83 c1 01             	add    $0x1,%ecx
  800ade:	bf 01 00 00 00       	mov    $0x1,%edi
  800ae3:	eb cb                	jmp    800ab0 <strtol+0x2d>
	if ((base == 0 || base == 16) && (s[0] == '0' && s[1] == 'x'))
  800ae5:	80 79 01 78          	cmpb   $0x78,0x1(%ecx)
  800ae9:	74 0e                	je     800af9 <strtol+0x76>
	else if (base == 0 && s[0] == '0')
  800aeb:	85 db                	test   %ebx,%ebx
  800aed:	75 d8                	jne    800ac7 <strtol+0x44>
		s++, base = 8;
  800aef:	83 c1 01             	add    $0x1,%ecx
  800af2:	bb 08 00 00 00       	mov    $0x8,%ebx
  800af7:	eb ce                	jmp    800ac7 <strtol+0x44>
		s += 2, base = 16;
  800af9:	83 c1 02             	add    $0x2,%ecx
  800afc:	bb 10 00 00 00       	mov    $0x10,%ebx
  800b01:	eb c4                	jmp    800ac7 <strtol+0x44>
	// digits
	while (1) {
		int dig;

		if (*s >= '0' && *s <= '9')
			dig = *s - '0';
  800b03:	0f be d2             	movsbl %dl,%edx
  800b06:	83 ea 30             	sub    $0x30,%edx
			dig = *s - 'a' + 10;
		else if (*s >= 'A' && *s <= 'Z')
			dig = *s - 'A' + 10;
		else
			break;
		if (dig >= base)
  800b09:	3b 55 10             	cmp    0x10(%ebp),%edx
  800b0c:	7d 3a                	jge    800b48 <strtol+0xc5>
			break;
		s++, val = (val * base) + dig;
  800b0e:	83 c1 01             	add    $0x1,%ecx
  800b11:	0f af 45 10          	imul   0x10(%ebp),%eax
  800b15:	01 d0                	add    %edx,%eax
		if (*s >= '0' && *s <= '9')
  800b17:	0f b6 11             	movzbl (%ecx),%edx
  800b1a:	8d 72 d0             	lea    -0x30(%edx),%esi
  800b1d:	89 f3                	mov    %esi,%ebx
  800b1f:	80 fb 09             	cmp    $0x9,%bl
  800b22:	76 df                	jbe    800b03 <strtol+0x80>
		else if (*s >= 'a' && *s <= 'z')
  800b24:	8d 72 9f             	lea    -0x61(%edx),%esi
  800b27:	89 f3                	mov    %esi,%ebx
  800b29:	80 fb 19             	cmp    $0x19,%bl
  800b2c:	77 08                	ja     800b36 <strtol+0xb3>
			dig = *s - 'a' + 10;
  800b2e:	0f be d2             	movsbl %dl,%edx
  800b31:	83 ea 57             	sub    $0x57,%edx
  800b34:	eb d3                	jmp    800b09 <strtol+0x86>
		else if (*s >= 'A' && *s <= 'Z')
  800b36:	8d 72 bf             	lea    -0x41(%edx),%esi
  800b39:	89 f3                	mov    %esi,%ebx
  800b3b:	80 fb 19             	cmp    $0x19,%bl
  800b3e:	77 08                	ja     800b48 <strtol+0xc5>
			dig = *s - 'A' + 10;
  800b40:	0f be d2             	movsbl %dl,%edx
  800b43:	83 ea 37             	sub    $0x37,%edx
  800b46:	eb c1                	jmp    800b09 <strtol+0x86>
		// we don't properly detect overflow!
	}

	if (endptr)
  800b48:	83 7d 0c 00          	cmpl   $0x0,0xc(%ebp)
  800b4c:	74 05                	je     800b53 <strtol+0xd0>
		*endptr = (char *) s;
  800b4e:	8b 75 0c             	mov    0xc(%ebp),%esi
  800b51:	89 0e                	mov    %ecx,(%esi)
	return (neg ? -val : val);
  800b53:	89 c2                	mov    %eax,%edx
  800b55:	f7 da                	neg    %edx
  800b57:	85 ff                	test   %edi,%edi
  800b59:	0f 45 c2             	cmovne %edx,%eax
}
  800b5c:	5b                   	pop    %ebx
  800b5d:	5e                   	pop    %esi
  800b5e:	5f                   	pop    %edi
  800b5f:	5d                   	pop    %ebp
  800b60:	c3                   	ret    

00800b61 <sys_cputs>:
	return ret;
}

void
sys_cputs(const char *s, size_t len)
{
  800b61:	f3 0f 1e fb          	endbr32 
  800b65:	55                   	push   %ebp
  800b66:	89 e5                	mov    %esp,%ebp
  800b68:	57                   	push   %edi
  800b69:	56                   	push   %esi
  800b6a:	53                   	push   %ebx
	asm volatile("int %1\n"
  800b6b:	b8 00 00 00 00       	mov    $0x0,%eax
  800b70:	8b 55 08             	mov    0x8(%ebp),%edx
  800b73:	8b 4d 0c             	mov    0xc(%ebp),%ecx
  800b76:	89 c3                	mov    %eax,%ebx
  800b78:	89 c7                	mov    %eax,%edi
  800b7a:	89 c6                	mov    %eax,%esi
  800b7c:	cd 30                	int    $0x30
	syscall(SYS_cputs, 0, (uint32_t)s, len, 0, 0, 0);
}
  800b7e:	5b                   	pop    %ebx
  800b7f:	5e                   	pop    %esi
  800b80:	5f                   	pop    %edi
  800b81:	5d                   	pop    %ebp
  800b82:	c3                   	ret    

00800b83 <sys_cgetc>:

int
sys_cgetc(void)
{
  800b83:	f3 0f 1e fb          	endbr32 
  800b87:	55                   	push   %ebp
  800b88:	89 e5                	mov    %esp,%ebp
  800b8a:	57                   	push   %edi
  800b8b:	56                   	push   %esi
  800b8c:	53                   	push   %ebx
	asm volatile("int %1\n"
  800b8d:	ba 00 00 00 00       	mov    $0x0,%edx
  800b92:	b8 01 00 00 00       	mov    $0x1,%eax
  800b97:	89 d1                	mov    %edx,%ecx
  800b99:	89 d3                	mov    %edx,%ebx
  800b9b:	89 d7                	mov    %edx,%edi
  800b9d:	89 d6                	mov    %edx,%esi
  800b9f:	cd 30                	int    $0x30
	return syscall(SYS_cgetc, 0, 0, 0, 0, 0, 0);
}
  800ba1:	5b                   	pop    %ebx
  800ba2:	5e                   	pop    %esi
  800ba3:	5f                   	pop    %edi
  800ba4:	5d                   	pop    %ebp
  800ba5:	c3                   	ret    

00800ba6 <sys_env_destroy>:

int
sys_env_destroy(envid_t envid)
{
  800ba6:	f3 0f 1e fb          	endbr32 
  800baa:	55                   	push   %ebp
  800bab:	89 e5                	mov    %esp,%ebp
  800bad:	57                   	push   %edi
  800bae:	56                   	push   %esi
  800baf:	53                   	push   %ebx
  800bb0:	83 ec 0c             	sub    $0xc,%esp
	asm volatile("int %1\n"
  800bb3:	b9 00 00 00 00       	mov    $0x0,%ecx
  800bb8:	8b 55 08             	mov    0x8(%ebp),%edx
  800bbb:	b8 03 00 00 00       	mov    $0x3,%eax
  800bc0:	89 cb                	mov    %ecx,%ebx
  800bc2:	89 cf                	mov    %ecx,%edi
  800bc4:	89 ce                	mov    %ecx,%esi
  800bc6:	cd 30                	int    $0x30
	if(check && ret > 0)
  800bc8:	85 c0                	test   %eax,%eax
  800bca:	7f 08                	jg     800bd4 <sys_env_destroy+0x2e>
	return syscall(SYS_env_destroy, 1, envid, 0, 0, 0, 0);
}
  800bcc:	8d 65 f4             	lea    -0xc(%ebp),%esp
  800bcf:	5b                   	pop    %ebx
  800bd0:	5e                   	pop    %esi
  800bd1:	5f                   	pop    %edi
  800bd2:	5d                   	pop    %ebp
  800bd3:	c3                   	ret    
		panic("syscall %d returned %d (> 0)", num, ret);
  800bd4:	83 ec 0c             	sub    $0xc,%esp
  800bd7:	50                   	push   %eax
  800bd8:	6a 03                	push   $0x3
  800bda:	68 df 26 80 00       	push   $0x8026df
  800bdf:	6a 23                	push   $0x23
  800be1:	68 fc 26 80 00       	push   $0x8026fc
  800be6:	e8 f3 13 00 00       	call   801fde <_panic>

00800beb <sys_getenvid>:

envid_t
sys_getenvid(void)
{
  800beb:	f3 0f 1e fb          	endbr32 
  800bef:	55                   	push   %ebp
  800bf0:	89 e5                	mov    %esp,%ebp
  800bf2:	57                   	push   %edi
  800bf3:	56                   	push   %esi
  800bf4:	53                   	push   %ebx
	asm volatile("int %1\n"
  800bf5:	ba 00 00 00 00       	mov    $0x0,%edx
  800bfa:	b8 02 00 00 00       	mov    $0x2,%eax
  800bff:	89 d1                	mov    %edx,%ecx
  800c01:	89 d3                	mov    %edx,%ebx
  800c03:	89 d7                	mov    %edx,%edi
  800c05:	89 d6                	mov    %edx,%esi
  800c07:	cd 30                	int    $0x30
	 return syscall(SYS_getenvid, 0, 0, 0, 0, 0, 0);
}
  800c09:	5b                   	pop    %ebx
  800c0a:	5e                   	pop    %esi
  800c0b:	5f                   	pop    %edi
  800c0c:	5d                   	pop    %ebp
  800c0d:	c3                   	ret    

00800c0e <sys_yield>:

void
sys_yield(void)
{
  800c0e:	f3 0f 1e fb          	endbr32 
  800c12:	55                   	push   %ebp
  800c13:	89 e5                	mov    %esp,%ebp
  800c15:	57                   	push   %edi
  800c16:	56                   	push   %esi
  800c17:	53                   	push   %ebx
	asm volatile("int %1\n"
  800c18:	ba 00 00 00 00       	mov    $0x0,%edx
  800c1d:	b8 0b 00 00 00       	mov    $0xb,%eax
  800c22:	89 d1                	mov    %edx,%ecx
  800c24:	89 d3                	mov    %edx,%ebx
  800c26:	89 d7                	mov    %edx,%edi
  800c28:	89 d6                	mov    %edx,%esi
  800c2a:	cd 30                	int    $0x30
	syscall(SYS_yield, 0, 0, 0, 0, 0, 0);
}
  800c2c:	5b                   	pop    %ebx
  800c2d:	5e                   	pop    %esi
  800c2e:	5f                   	pop    %edi
  800c2f:	5d                   	pop    %ebp
  800c30:	c3                   	ret    

00800c31 <sys_page_alloc>:

int
sys_page_alloc(envid_t envid, void *va, int perm)
{
  800c31:	f3 0f 1e fb          	endbr32 
  800c35:	55                   	push   %ebp
  800c36:	89 e5                	mov    %esp,%ebp
  800c38:	57                   	push   %edi
  800c39:	56                   	push   %esi
  800c3a:	53                   	push   %ebx
  800c3b:	83 ec 0c             	sub    $0xc,%esp
	asm volatile("int %1\n"
  800c3e:	be 00 00 00 00       	mov    $0x0,%esi
  800c43:	8b 55 08             	mov    0x8(%ebp),%edx
  800c46:	8b 4d 0c             	mov    0xc(%ebp),%ecx
  800c49:	b8 04 00 00 00       	mov    $0x4,%eax
  800c4e:	8b 5d 10             	mov    0x10(%ebp),%ebx
  800c51:	89 f7                	mov    %esi,%edi
  800c53:	cd 30                	int    $0x30
	if(check && ret > 0)
  800c55:	85 c0                	test   %eax,%eax
  800c57:	7f 08                	jg     800c61 <sys_page_alloc+0x30>
	return syscall(SYS_page_alloc, 1, envid, (uint32_t) va, perm, 0, 0);
}
  800c59:	8d 65 f4             	lea    -0xc(%ebp),%esp
  800c5c:	5b                   	pop    %ebx
  800c5d:	5e                   	pop    %esi
  800c5e:	5f                   	pop    %edi
  800c5f:	5d                   	pop    %ebp
  800c60:	c3                   	ret    
		panic("syscall %d returned %d (> 0)", num, ret);
  800c61:	83 ec 0c             	sub    $0xc,%esp
  800c64:	50                   	push   %eax
  800c65:	6a 04                	push   $0x4
  800c67:	68 df 26 80 00       	push   $0x8026df
  800c6c:	6a 23                	push   $0x23
  800c6e:	68 fc 26 80 00       	push   $0x8026fc
  800c73:	e8 66 13 00 00       	call   801fde <_panic>

00800c78 <sys_page_map>:

int
sys_page_map(envid_t srcenv, void *srcva, envid_t dstenv, void *dstva, int perm)
{
  800c78:	f3 0f 1e fb          	endbr32 
  800c7c:	55                   	push   %ebp
  800c7d:	89 e5                	mov    %esp,%ebp
  800c7f:	57                   	push   %edi
  800c80:	56                   	push   %esi
  800c81:	53                   	push   %ebx
  800c82:	83 ec 0c             	sub    $0xc,%esp
	asm volatile("int %1\n"
  800c85:	8b 55 08             	mov    0x8(%ebp),%edx
  800c88:	8b 4d 0c             	mov    0xc(%ebp),%ecx
  800c8b:	b8 05 00 00 00       	mov    $0x5,%eax
  800c90:	8b 5d 10             	mov    0x10(%ebp),%ebx
  800c93:	8b 7d 14             	mov    0x14(%ebp),%edi
  800c96:	8b 75 18             	mov    0x18(%ebp),%esi
  800c99:	cd 30                	int    $0x30
	if(check && ret > 0)
  800c9b:	85 c0                	test   %eax,%eax
  800c9d:	7f 08                	jg     800ca7 <sys_page_map+0x2f>
	return syscall(SYS_page_map, 1, srcenv, (uint32_t) srcva, dstenv, (uint32_t) dstva, perm);
}
  800c9f:	8d 65 f4             	lea    -0xc(%ebp),%esp
  800ca2:	5b                   	pop    %ebx
  800ca3:	5e                   	pop    %esi
  800ca4:	5f                   	pop    %edi
  800ca5:	5d                   	pop    %ebp
  800ca6:	c3                   	ret    
		panic("syscall %d returned %d (> 0)", num, ret);
  800ca7:	83 ec 0c             	sub    $0xc,%esp
  800caa:	50                   	push   %eax
  800cab:	6a 05                	push   $0x5
  800cad:	68 df 26 80 00       	push   $0x8026df
  800cb2:	6a 23                	push   $0x23
  800cb4:	68 fc 26 80 00       	push   $0x8026fc
  800cb9:	e8 20 13 00 00       	call   801fde <_panic>

00800cbe <sys_page_unmap>:

int
sys_page_unmap(envid_t envid, void *va)
{
  800cbe:	f3 0f 1e fb          	endbr32 
  800cc2:	55                   	push   %ebp
  800cc3:	89 e5                	mov    %esp,%ebp
  800cc5:	57                   	push   %edi
  800cc6:	56                   	push   %esi
  800cc7:	53                   	push   %ebx
  800cc8:	83 ec 0c             	sub    $0xc,%esp
	asm volatile("int %1\n"
  800ccb:	bb 00 00 00 00       	mov    $0x0,%ebx
  800cd0:	8b 55 08             	mov    0x8(%ebp),%edx
  800cd3:	8b 4d 0c             	mov    0xc(%ebp),%ecx
  800cd6:	b8 06 00 00 00       	mov    $0x6,%eax
  800cdb:	89 df                	mov    %ebx,%edi
  800cdd:	89 de                	mov    %ebx,%esi
  800cdf:	cd 30                	int    $0x30
	if(check && ret > 0)
  800ce1:	85 c0                	test   %eax,%eax
  800ce3:	7f 08                	jg     800ced <sys_page_unmap+0x2f>
	return syscall(SYS_page_unmap, 1, envid, (uint32_t) va, 0, 0, 0);
}
  800ce5:	8d 65 f4             	lea    -0xc(%ebp),%esp
  800ce8:	5b                   	pop    %ebx
  800ce9:	5e                   	pop    %esi
  800cea:	5f                   	pop    %edi
  800ceb:	5d                   	pop    %ebp
  800cec:	c3                   	ret    
		panic("syscall %d returned %d (> 0)", num, ret);
  800ced:	83 ec 0c             	sub    $0xc,%esp
  800cf0:	50                   	push   %eax
  800cf1:	6a 06                	push   $0x6
  800cf3:	68 df 26 80 00       	push   $0x8026df
  800cf8:	6a 23                	push   $0x23
  800cfa:	68 fc 26 80 00       	push   $0x8026fc
  800cff:	e8 da 12 00 00       	call   801fde <_panic>

00800d04 <sys_env_set_status>:

// sys_exofork is inlined in lib.h

int
sys_env_set_status(envid_t envid, int status)
{
  800d04:	f3 0f 1e fb          	endbr32 
  800d08:	55                   	push   %ebp
  800d09:	89 e5                	mov    %esp,%ebp
  800d0b:	57                   	push   %edi
  800d0c:	56                   	push   %esi
  800d0d:	53                   	push   %ebx
  800d0e:	83 ec 0c             	sub    $0xc,%esp
	asm volatile("int %1\n"
  800d11:	bb 00 00 00 00       	mov    $0x0,%ebx
  800d16:	8b 55 08             	mov    0x8(%ebp),%edx
  800d19:	8b 4d 0c             	mov    0xc(%ebp),%ecx
  800d1c:	b8 08 00 00 00       	mov    $0x8,%eax
  800d21:	89 df                	mov    %ebx,%edi
  800d23:	89 de                	mov    %ebx,%esi
  800d25:	cd 30                	int    $0x30
	if(check && ret > 0)
  800d27:	85 c0                	test   %eax,%eax
  800d29:	7f 08                	jg     800d33 <sys_env_set_status+0x2f>
	return syscall(SYS_env_set_status, 1, envid, status, 0, 0, 0);
}
  800d2b:	8d 65 f4             	lea    -0xc(%ebp),%esp
  800d2e:	5b                   	pop    %ebx
  800d2f:	5e                   	pop    %esi
  800d30:	5f                   	pop    %edi
  800d31:	5d                   	pop    %ebp
  800d32:	c3                   	ret    
		panic("syscall %d returned %d (> 0)", num, ret);
  800d33:	83 ec 0c             	sub    $0xc,%esp
  800d36:	50                   	push   %eax
  800d37:	6a 08                	push   $0x8
  800d39:	68 df 26 80 00       	push   $0x8026df
  800d3e:	6a 23                	push   $0x23
  800d40:	68 fc 26 80 00       	push   $0x8026fc
  800d45:	e8 94 12 00 00       	call   801fde <_panic>

00800d4a <sys_env_set_trapframe>:

int
sys_env_set_trapframe(envid_t envid, struct Trapframe *tf)
{
  800d4a:	f3 0f 1e fb          	endbr32 
  800d4e:	55                   	push   %ebp
  800d4f:	89 e5                	mov    %esp,%ebp
  800d51:	57                   	push   %edi
  800d52:	56                   	push   %esi
  800d53:	53                   	push   %ebx
  800d54:	83 ec 0c             	sub    $0xc,%esp
	asm volatile("int %1\n"
  800d57:	bb 00 00 00 00       	mov    $0x0,%ebx
  800d5c:	8b 55 08             	mov    0x8(%ebp),%edx
  800d5f:	8b 4d 0c             	mov    0xc(%ebp),%ecx
  800d62:	b8 09 00 00 00       	mov    $0x9,%eax
  800d67:	89 df                	mov    %ebx,%edi
  800d69:	89 de                	mov    %ebx,%esi
  800d6b:	cd 30                	int    $0x30
	if(check && ret > 0)
  800d6d:	85 c0                	test   %eax,%eax
  800d6f:	7f 08                	jg     800d79 <sys_env_set_trapframe+0x2f>
	return syscall(SYS_env_set_trapframe, 1, envid, (uint32_t) tf, 0, 0, 0);
}
  800d71:	8d 65 f4             	lea    -0xc(%ebp),%esp
  800d74:	5b                   	pop    %ebx
  800d75:	5e                   	pop    %esi
  800d76:	5f                   	pop    %edi
  800d77:	5d                   	pop    %ebp
  800d78:	c3                   	ret    
		panic("syscall %d returned %d (> 0)", num, ret);
  800d79:	83 ec 0c             	sub    $0xc,%esp
  800d7c:	50                   	push   %eax
  800d7d:	6a 09                	push   $0x9
  800d7f:	68 df 26 80 00       	push   $0x8026df
  800d84:	6a 23                	push   $0x23
  800d86:	68 fc 26 80 00       	push   $0x8026fc
  800d8b:	e8 4e 12 00 00       	call   801fde <_panic>

00800d90 <sys_env_set_pgfault_upcall>:

int
sys_env_set_pgfault_upcall(envid_t envid, void *upcall)
{
  800d90:	f3 0f 1e fb          	endbr32 
  800d94:	55                   	push   %ebp
  800d95:	89 e5                	mov    %esp,%ebp
  800d97:	57                   	push   %edi
  800d98:	56                   	push   %esi
  800d99:	53                   	push   %ebx
  800d9a:	83 ec 0c             	sub    $0xc,%esp
	asm volatile("int %1\n"
  800d9d:	bb 00 00 00 00       	mov    $0x0,%ebx
  800da2:	8b 55 08             	mov    0x8(%ebp),%edx
  800da5:	8b 4d 0c             	mov    0xc(%ebp),%ecx
  800da8:	b8 0a 00 00 00       	mov    $0xa,%eax
  800dad:	89 df                	mov    %ebx,%edi
  800daf:	89 de                	mov    %ebx,%esi
  800db1:	cd 30                	int    $0x30
	if(check && ret > 0)
  800db3:	85 c0                	test   %eax,%eax
  800db5:	7f 08                	jg     800dbf <sys_env_set_pgfault_upcall+0x2f>
	return syscall(SYS_env_set_pgfault_upcall, 1, envid, (uint32_t) upcall, 0, 0, 0);
}
  800db7:	8d 65 f4             	lea    -0xc(%ebp),%esp
  800dba:	5b                   	pop    %ebx
  800dbb:	5e                   	pop    %esi
  800dbc:	5f                   	pop    %edi
  800dbd:	5d                   	pop    %ebp
  800dbe:	c3                   	ret    
		panic("syscall %d returned %d (> 0)", num, ret);
  800dbf:	83 ec 0c             	sub    $0xc,%esp
  800dc2:	50                   	push   %eax
  800dc3:	6a 0a                	push   $0xa
  800dc5:	68 df 26 80 00       	push   $0x8026df
  800dca:	6a 23                	push   $0x23
  800dcc:	68 fc 26 80 00       	push   $0x8026fc
  800dd1:	e8 08 12 00 00       	call   801fde <_panic>

00800dd6 <sys_ipc_try_send>:

int
sys_ipc_try_send(envid_t envid, uint32_t value, void *srcva, int perm)
{
  800dd6:	f3 0f 1e fb          	endbr32 
  800dda:	55                   	push   %ebp
  800ddb:	89 e5                	mov    %esp,%ebp
  800ddd:	57                   	push   %edi
  800dde:	56                   	push   %esi
  800ddf:	53                   	push   %ebx
	asm volatile("int %1\n"
  800de0:	8b 55 08             	mov    0x8(%ebp),%edx
  800de3:	8b 4d 0c             	mov    0xc(%ebp),%ecx
  800de6:	b8 0c 00 00 00       	mov    $0xc,%eax
  800deb:	be 00 00 00 00       	mov    $0x0,%esi
  800df0:	8b 5d 10             	mov    0x10(%ebp),%ebx
  800df3:	8b 7d 14             	mov    0x14(%ebp),%edi
  800df6:	cd 30                	int    $0x30
	return syscall(SYS_ipc_try_send, 0, envid, value, (uint32_t) srcva, perm, 0);
}
  800df8:	5b                   	pop    %ebx
  800df9:	5e                   	pop    %esi
  800dfa:	5f                   	pop    %edi
  800dfb:	5d                   	pop    %ebp
  800dfc:	c3                   	ret    

00800dfd <sys_ipc_recv>:

int
sys_ipc_recv(void *dstva)
{
  800dfd:	f3 0f 1e fb          	endbr32 
  800e01:	55                   	push   %ebp
  800e02:	89 e5                	mov    %esp,%ebp
  800e04:	57                   	push   %edi
  800e05:	56                   	push   %esi
  800e06:	53                   	push   %ebx
  800e07:	83 ec 0c             	sub    $0xc,%esp
	asm volatile("int %1\n"
  800e0a:	b9 00 00 00 00       	mov    $0x0,%ecx
  800e0f:	8b 55 08             	mov    0x8(%ebp),%edx
  800e12:	b8 0d 00 00 00       	mov    $0xd,%eax
  800e17:	89 cb                	mov    %ecx,%ebx
  800e19:	89 cf                	mov    %ecx,%edi
  800e1b:	89 ce                	mov    %ecx,%esi
  800e1d:	cd 30                	int    $0x30
	if(check && ret > 0)
  800e1f:	85 c0                	test   %eax,%eax
  800e21:	7f 08                	jg     800e2b <sys_ipc_recv+0x2e>
	return syscall(SYS_ipc_recv, 1, (uint32_t)dstva, 0, 0, 0, 0);
}
  800e23:	8d 65 f4             	lea    -0xc(%ebp),%esp
  800e26:	5b                   	pop    %ebx
  800e27:	5e                   	pop    %esi
  800e28:	5f                   	pop    %edi
  800e29:	5d                   	pop    %ebp
  800e2a:	c3                   	ret    
		panic("syscall %d returned %d (> 0)", num, ret);
  800e2b:	83 ec 0c             	sub    $0xc,%esp
  800e2e:	50                   	push   %eax
  800e2f:	6a 0d                	push   $0xd
  800e31:	68 df 26 80 00       	push   $0x8026df
  800e36:	6a 23                	push   $0x23
  800e38:	68 fc 26 80 00       	push   $0x8026fc
  800e3d:	e8 9c 11 00 00       	call   801fde <_panic>

00800e42 <pgfault>:
// Custom page fault handler - if faulting page is copy-on-write,
// map in our own private writable copy.
//
static void
pgfault(struct UTrapframe *utf)
{
  800e42:	f3 0f 1e fb          	endbr32 
  800e46:	55                   	push   %ebp
  800e47:	89 e5                	mov    %esp,%ebp
  800e49:	56                   	push   %esi
  800e4a:	53                   	push   %ebx
  800e4b:	8b 45 08             	mov    0x8(%ebp),%eax
	void *addr = (void *) utf->utf_fault_va;
  800e4e:	8b 18                	mov    (%eax),%ebx
	/*
	将父进程空间中所有可以写的页表的部分全部标记为可读且COW【因此读取的时候不会进入pgfault，但是写的时候会触发pgfault】。
	而当父进程或者子进程任意一个发生了写的时候，因为页表现在都是不可写的，所以会触发异常，进入到我们设定的page fault处理例程，
	当检测到是对COW页的写操作的情况下，就可以将要写入的页的内容全部拷贝一份，重新映射。
	*/
    if (!((err & FEC_WR) && (uvpd[PDX(addr)] & PTE_P) && 
  800e50:	f6 40 04 02          	testb  $0x2,0x4(%eax)
  800e54:	0f 84 b2 00 00 00    	je     800f0c <pgfault+0xca>
  800e5a:	89 d8                	mov    %ebx,%eax
  800e5c:	c1 e8 16             	shr    $0x16,%eax
  800e5f:	8b 04 85 00 d0 7b ef 	mov    -0x10843000(,%eax,4),%eax
  800e66:	a8 01                	test   $0x1,%al
  800e68:	0f 84 9e 00 00 00    	je     800f0c <pgfault+0xca>
			(uvpt[PGNUM(addr)] & PTE_P) && (uvpt[PGNUM(addr)] & PTE_COW)))
  800e6e:	89 d8                	mov    %ebx,%eax
  800e70:	c1 e8 0c             	shr    $0xc,%eax
  800e73:	8b 14 85 00 00 40 ef 	mov    -0x10c00000(,%eax,4),%edx
    if (!((err & FEC_WR) && (uvpd[PDX(addr)] & PTE_P) && 
  800e7a:	f6 c2 01             	test   $0x1,%dl
  800e7d:	0f 84 89 00 00 00    	je     800f0c <pgfault+0xca>
			(uvpt[PGNUM(addr)] & PTE_P) && (uvpt[PGNUM(addr)] & PTE_COW)))
  800e83:	8b 04 85 00 00 40 ef 	mov    -0x10c00000(,%eax,4),%eax
    if (!((err & FEC_WR) && (uvpd[PDX(addr)] & PTE_P) && 
  800e8a:	f6 c4 08             	test   $0x8,%ah
  800e8d:	74 7d                	je     800f0c <pgfault+0xca>
                panic("pgfault: it's not writable or attempt to access a non-cow page!");
	//为该进程分配新的页面。
	envid_t envid=sys_getenvid();
  800e8f:	e8 57 fd ff ff       	call   800beb <sys_getenvid>
  800e94:	89 c6                	mov    %eax,%esi
	r=sys_page_alloc(envid,(void*)PFTEMP,PTE_P|PTE_U|PTE_W);
  800e96:	83 ec 04             	sub    $0x4,%esp
  800e99:	6a 07                	push   $0x7
  800e9b:	68 00 f0 7f 00       	push   $0x7ff000
  800ea0:	50                   	push   %eax
  800ea1:	e8 8b fd ff ff       	call   800c31 <sys_page_alloc>
	if(r<0){
  800ea6:	83 c4 10             	add    $0x10,%esp
  800ea9:	85 c0                	test   %eax,%eax
  800eab:	78 73                	js     800f20 <pgfault+0xde>
		 panic("pgfault: page allocation failed %e", r);
	}
	//解开了我的疑惑，为什么随着fork页空间会逐渐发生偏移。
	//迁移数据过去。
	addr=ROUNDDOWN(addr,PGSIZE);
  800ead:	81 e3 00 f0 ff ff    	and    $0xfffff000,%ebx
	//拷贝内容。
	memmove(PFTEMP,addr,PGSIZE);
  800eb3:	83 ec 04             	sub    $0x4,%esp
  800eb6:	68 00 10 00 00       	push   $0x1000
  800ebb:	53                   	push   %ebx
  800ebc:	68 00 f0 7f 00       	push   $0x7ff000
  800ec1:	e8 df fa ff ff       	call   8009a5 <memmove>
	//解除和addr的映射关系。
	r=sys_page_unmap(envid,(void*)addr);
  800ec6:	83 c4 08             	add    $0x8,%esp
  800ec9:	53                   	push   %ebx
  800eca:	56                   	push   %esi
  800ecb:	e8 ee fd ff ff       	call   800cbe <sys_page_unmap>
	if(r<0)
  800ed0:	83 c4 10             	add    $0x10,%esp
  800ed3:	85 c0                	test   %eax,%eax
  800ed5:	78 5b                	js     800f32 <pgfault+0xf0>
	panic("pgfault: page unmap failed %e", r);
	r=sys_page_map(envid,PFTEMP,envid,addr,PTE_P|PTE_U|PTE_W);
  800ed7:	83 ec 0c             	sub    $0xc,%esp
  800eda:	6a 07                	push   $0x7
  800edc:	53                   	push   %ebx
  800edd:	56                   	push   %esi
  800ede:	68 00 f0 7f 00       	push   $0x7ff000
  800ee3:	56                   	push   %esi
  800ee4:	e8 8f fd ff ff       	call   800c78 <sys_page_map>
	if(r<0)
  800ee9:	83 c4 20             	add    $0x20,%esp
  800eec:	85 c0                	test   %eax,%eax
  800eee:	78 54                	js     800f44 <pgfault+0x102>
	panic("pgfault: page map failed %e", r);
	r=sys_page_unmap(envid,PFTEMP);
  800ef0:	83 ec 08             	sub    $0x8,%esp
  800ef3:	68 00 f0 7f 00       	push   $0x7ff000
  800ef8:	56                   	push   %esi
  800ef9:	e8 c0 fd ff ff       	call   800cbe <sys_page_unmap>
	if(r<0)
  800efe:	83 c4 10             	add    $0x10,%esp
  800f01:	85 c0                	test   %eax,%eax
  800f03:	78 51                	js     800f56 <pgfault+0x114>
	panic("pgfault: page unmap failed %e", r);
}
  800f05:	8d 65 f8             	lea    -0x8(%ebp),%esp
  800f08:	5b                   	pop    %ebx
  800f09:	5e                   	pop    %esi
  800f0a:	5d                   	pop    %ebp
  800f0b:	c3                   	ret    
                panic("pgfault: it's not writable or attempt to access a non-cow page!");
  800f0c:	83 ec 04             	sub    $0x4,%esp
  800f0f:	68 0c 27 80 00       	push   $0x80270c
  800f14:	6a 2c                	push   $0x2c
  800f16:	68 bb 27 80 00       	push   $0x8027bb
  800f1b:	e8 be 10 00 00       	call   801fde <_panic>
		 panic("pgfault: page allocation failed %e", r);
  800f20:	50                   	push   %eax
  800f21:	68 4c 27 80 00       	push   $0x80274c
  800f26:	6a 31                	push   $0x31
  800f28:	68 bb 27 80 00       	push   $0x8027bb
  800f2d:	e8 ac 10 00 00       	call   801fde <_panic>
	panic("pgfault: page unmap failed %e", r);
  800f32:	50                   	push   %eax
  800f33:	68 c6 27 80 00       	push   $0x8027c6
  800f38:	6a 3b                	push   $0x3b
  800f3a:	68 bb 27 80 00       	push   $0x8027bb
  800f3f:	e8 9a 10 00 00       	call   801fde <_panic>
	panic("pgfault: page map failed %e", r);
  800f44:	50                   	push   %eax
  800f45:	68 e4 27 80 00       	push   $0x8027e4
  800f4a:	6a 3e                	push   $0x3e
  800f4c:	68 bb 27 80 00       	push   $0x8027bb
  800f51:	e8 88 10 00 00       	call   801fde <_panic>
	panic("pgfault: page unmap failed %e", r);
  800f56:	50                   	push   %eax
  800f57:	68 c6 27 80 00       	push   $0x8027c6
  800f5c:	6a 41                	push   $0x41
  800f5e:	68 bb 27 80 00       	push   $0x8027bb
  800f63:	e8 76 10 00 00       	call   801fde <_panic>

00800f68 <fork>:
//   Neither user exception stack should ever be marked copy-on-write,
//   so you must allocate a new page for the child's user exception stack.
//
envid_t
fork(void)
{
  800f68:	f3 0f 1e fb          	endbr32 
  800f6c:	55                   	push   %ebp
  800f6d:	89 e5                	mov    %esp,%ebp
  800f6f:	57                   	push   %edi
  800f70:	56                   	push   %esi
  800f71:	53                   	push   %ebx
  800f72:	83 ec 28             	sub    $0x28,%esp
	// LAB 4: Your code here.
	envid_t envid;
	uintptr_t pageVa;
	unsigned pn;
	//设置pgfault情况下对应处理的函数。
	set_pgfault_handler(pgfault);
  800f75:	68 42 0e 80 00       	push   $0x800e42
  800f7a:	e8 a9 10 00 00       	call   802028 <set_pgfault_handler>
// This must be inlined.  Exercise for reader: why?
static inline envid_t __attribute__((always_inline))
sys_exofork(void)
{
	envid_t ret;
	asm volatile("int %2"
  800f7f:	b8 07 00 00 00       	mov    $0x7,%eax
  800f84:	cd 30                	int    $0x30
  800f86:	89 c7                	mov    %eax,%edi
  800f88:	89 45 e4             	mov    %eax,-0x1c(%ebp)
	//首先需要分配一个env，env_alloc是内核态调用的，因此只能去调系统调用对应的函数来请求分配一个环境描述符。
	envid=sys_exofork();
	//分配成功
	if(envid>0){
  800f8b:	83 c4 10             	add    $0x10,%esp
  800f8e:	85 c0                	test   %eax,%eax
  800f90:	0f 8e 9d 01 00 00    	jle    801133 <fork+0x1cb>
		//接下来应该要拷贝父进程。当然这里让我吃惊的是直接可以调用对应的宏并且并没有去请求父进程。jos系统似乎是把所有的子进程都来源于同一进程，而不是父子继承关系。
		for(pageVa=UTEXT;pageVa<USTACKTOP;pageVa+=PGSIZE){
  800f96:	bb 00 00 80 00       	mov    $0x800000,%ebx
  800f9b:	eb 5b                	jmp    800ff8 <fork+0x90>
			sys_page_map(0, addr, envid, addr, PTE_SYSCALL);
  800f9d:	83 ec 0c             	sub    $0xc,%esp
  800fa0:	68 07 0e 00 00       	push   $0xe07
  800fa5:	56                   	push   %esi
  800fa6:	ff 75 e4             	pushl  -0x1c(%ebp)
  800fa9:	56                   	push   %esi
  800faa:	6a 00                	push   $0x0
  800fac:	e8 c7 fc ff ff       	call   800c78 <sys_page_map>
  800fb1:	83 c4 20             	add    $0x20,%esp
  800fb4:	eb 30                	jmp    800fe6 <fork+0x7e>
                panic("duppage: sys_page_map fail\n");
  800fb6:	83 ec 04             	sub    $0x4,%esp
  800fb9:	68 00 28 80 00       	push   $0x802800
  800fbe:	6a 63                	push   $0x63
  800fc0:	68 bb 27 80 00       	push   $0x8027bb
  800fc5:	e8 14 10 00 00       	call   801fde <_panic>
            r = sys_page_map(0, addr, envid, addr, PTE_U | PTE_P);
  800fca:	83 ec 0c             	sub    $0xc,%esp
  800fcd:	6a 05                	push   $0x5
  800fcf:	56                   	push   %esi
  800fd0:	ff 75 e4             	pushl  -0x1c(%ebp)
  800fd3:	56                   	push   %esi
  800fd4:	6a 00                	push   $0x0
  800fd6:	e8 9d fc ff ff       	call   800c78 <sys_page_map>
            if(r < 0)
  800fdb:	83 c4 20             	add    $0x20,%esp
  800fde:	85 c0                	test   %eax,%eax
  800fe0:	0f 88 ac 00 00 00    	js     801092 <fork+0x12a>
		for(pageVa=UTEXT;pageVa<USTACKTOP;pageVa+=PGSIZE){
  800fe6:	81 c3 00 10 00 00    	add    $0x1000,%ebx
  800fec:	81 fb 00 e0 bf ee    	cmp    $0xeebfe000,%ebx
  800ff2:	0f 84 ae 00 00 00    	je     8010a6 <fork+0x13e>
			pn=PGNUM(pageVa);
			//检查权限，挨个copy页
			if((uvpd[PDX(pageVa)]&PTE_P)&&(uvpt[pn]&PTE_P)&&(uvpt[pn]&PTE_U)){
  800ff8:	89 d8                	mov    %ebx,%eax
  800ffa:	c1 e8 16             	shr    $0x16,%eax
  800ffd:	8b 04 85 00 d0 7b ef 	mov    -0x10843000(,%eax,4),%eax
  801004:	a8 01                	test   $0x1,%al
  801006:	74 de                	je     800fe6 <fork+0x7e>
			pn=PGNUM(pageVa);
  801008:	89 d8                	mov    %ebx,%eax
  80100a:	c1 e8 0c             	shr    $0xc,%eax
			if((uvpd[PDX(pageVa)]&PTE_P)&&(uvpt[pn]&PTE_P)&&(uvpt[pn]&PTE_U)){
  80100d:	8b 14 85 00 00 40 ef 	mov    -0x10c00000(,%eax,4),%edx
  801014:	f6 c2 01             	test   $0x1,%dl
  801017:	74 cd                	je     800fe6 <fork+0x7e>
  801019:	8b 14 85 00 00 40 ef 	mov    -0x10c00000(,%eax,4),%edx
  801020:	f6 c2 04             	test   $0x4,%dl
  801023:	74 c1                	je     800fe6 <fork+0x7e>
        addr = (void *)((uint32_t)pn * PGSIZE);
  801025:	89 c6                	mov    %eax,%esi
  801027:	c1 e6 0c             	shl    $0xc,%esi
        pte = uvpt[pn];
  80102a:	8b 04 85 00 00 40 ef 	mov    -0x10c00000(,%eax,4),%eax
		if(pte&PTE_SHARE){
  801031:	f6 c4 04             	test   $0x4,%ah
  801034:	0f 85 63 ff ff ff    	jne    800f9d <fork+0x35>
        else if((pte & PTE_COW) || (pte & PTE_W))
  80103a:	a9 02 08 00 00       	test   $0x802,%eax
  80103f:	74 89                	je     800fca <fork+0x62>
            r = sys_page_map(0, addr, envid, addr, PTE_COW | PTE_U | PTE_P);
  801041:	83 ec 0c             	sub    $0xc,%esp
  801044:	68 05 08 00 00       	push   $0x805
  801049:	56                   	push   %esi
  80104a:	ff 75 e4             	pushl  -0x1c(%ebp)
  80104d:	56                   	push   %esi
  80104e:	6a 00                	push   $0x0
  801050:	e8 23 fc ff ff       	call   800c78 <sys_page_map>
            if(r < 0)
  801055:	83 c4 20             	add    $0x20,%esp
  801058:	85 c0                	test   %eax,%eax
  80105a:	0f 88 56 ff ff ff    	js     800fb6 <fork+0x4e>
            r = sys_page_map(0, addr, 0, addr, PTE_COW | PTE_U | PTE_P);
  801060:	83 ec 0c             	sub    $0xc,%esp
  801063:	68 05 08 00 00       	push   $0x805
  801068:	56                   	push   %esi
  801069:	6a 00                	push   $0x0
  80106b:	56                   	push   %esi
  80106c:	6a 00                	push   $0x0
  80106e:	e8 05 fc ff ff       	call   800c78 <sys_page_map>
            if(r < 0)
  801073:	83 c4 20             	add    $0x20,%esp
  801076:	85 c0                	test   %eax,%eax
  801078:	0f 89 68 ff ff ff    	jns    800fe6 <fork+0x7e>
                panic("duppage: sys_page_map fail\n");
  80107e:	83 ec 04             	sub    $0x4,%esp
  801081:	68 00 28 80 00       	push   $0x802800
  801086:	6a 66                	push   $0x66
  801088:	68 bb 27 80 00       	push   $0x8027bb
  80108d:	e8 4c 0f 00 00       	call   801fde <_panic>
                panic("duppage: sys_page_map fail\n");
  801092:	83 ec 04             	sub    $0x4,%esp
  801095:	68 00 28 80 00       	push   $0x802800
  80109a:	6a 6c                	push   $0x6c
  80109c:	68 bb 27 80 00       	push   $0x8027bb
  8010a1:	e8 38 0f 00 00       	call   801fde <_panic>
				duppage(envid,pn);}
			}
		//分配异常栈。
		int32_t flag=sys_page_alloc(envid,(void*)(UXSTACKTOP-PGSIZE),PTE_P|PTE_U|PTE_W);
  8010a6:	83 ec 04             	sub    $0x4,%esp
  8010a9:	6a 07                	push   $0x7
  8010ab:	68 00 f0 bf ee       	push   $0xeebff000
  8010b0:	57                   	push   %edi
  8010b1:	e8 7b fb ff ff       	call   800c31 <sys_page_alloc>
		if(flag<0){
  8010b6:	83 c4 10             	add    $0x10,%esp
  8010b9:	85 c0                	test   %eax,%eax
  8010bb:	78 31                	js     8010ee <fork+0x186>
			panic("panic by alloc page");
		}
		//设置对应的异常处理函数。
		extern void _pgfault_upcall(void);
		flag=sys_env_set_pgfault_upcall(envid,_pgfault_upcall);
  8010bd:	83 ec 08             	sub    $0x8,%esp
  8010c0:	68 a2 20 80 00       	push   $0x8020a2
  8010c5:	57                   	push   %edi
  8010c6:	e8 c5 fc ff ff       	call   800d90 <sys_env_set_pgfault_upcall>
		if(flag<0){
  8010cb:	83 c4 10             	add    $0x10,%esp
  8010ce:	85 c0                	test   %eax,%eax
  8010d0:	78 33                	js     801105 <fork+0x19d>
			panic("panic by set pgfault upcall faction");
		}
		//设置子进程，等待调度。
		flag=sys_env_set_status(envid,ENV_RUNNABLE);
  8010d2:	83 ec 08             	sub    $0x8,%esp
  8010d5:	6a 02                	push   $0x2
  8010d7:	57                   	push   %edi
  8010d8:	e8 27 fc ff ff       	call   800d04 <sys_env_set_status>
		if(flag<0){
  8010dd:	83 c4 10             	add    $0x10,%esp
  8010e0:	85 c0                	test   %eax,%eax
  8010e2:	78 38                	js     80111c <fork+0x1b4>
		//否则报错。
		panic("panic by alloc envid");
	}

	
}
  8010e4:	89 f8                	mov    %edi,%eax
  8010e6:	8d 65 f4             	lea    -0xc(%ebp),%esp
  8010e9:	5b                   	pop    %ebx
  8010ea:	5e                   	pop    %esi
  8010eb:	5f                   	pop    %edi
  8010ec:	5d                   	pop    %ebp
  8010ed:	c3                   	ret    
			panic("panic by alloc page");
  8010ee:	83 ec 04             	sub    $0x4,%esp
  8010f1:	68 1c 28 80 00       	push   $0x80281c
  8010f6:	68 98 00 00 00       	push   $0x98
  8010fb:	68 bb 27 80 00       	push   $0x8027bb
  801100:	e8 d9 0e 00 00       	call   801fde <_panic>
			panic("panic by set pgfault upcall faction");
  801105:	83 ec 04             	sub    $0x4,%esp
  801108:	68 70 27 80 00       	push   $0x802770
  80110d:	68 9e 00 00 00       	push   $0x9e
  801112:	68 bb 27 80 00       	push   $0x8027bb
  801117:	e8 c2 0e 00 00       	call   801fde <_panic>
			panic("panic by set env status to ENV_RUNABLE");
  80111c:	83 ec 04             	sub    $0x4,%esp
  80111f:	68 94 27 80 00       	push   $0x802794
  801124:	68 a3 00 00 00       	push   $0xa3
  801129:	68 bb 27 80 00       	push   $0x8027bb
  80112e:	e8 ab 0e 00 00       	call   801fde <_panic>
	else if(envid==0){
  801133:	75 19                	jne    80114e <fork+0x1e6>
        thisenv = &envs[ENVX(sys_getenvid())];	//在子进程中设置thisenv为自己
  801135:	e8 b1 fa ff ff       	call   800beb <sys_getenvid>
  80113a:	25 ff 03 00 00       	and    $0x3ff,%eax
  80113f:	6b c0 7c             	imul   $0x7c,%eax,%eax
  801142:	05 00 00 c0 ee       	add    $0xeec00000,%eax
  801147:	a3 08 40 80 00       	mov    %eax,0x804008
		return 0;
  80114c:	eb 96                	jmp    8010e4 <fork+0x17c>
		panic("panic by alloc envid");
  80114e:	83 ec 04             	sub    $0x4,%esp
  801151:	68 30 28 80 00       	push   $0x802830
  801156:	68 ad 00 00 00       	push   $0xad
  80115b:	68 bb 27 80 00       	push   $0x8027bb
  801160:	e8 79 0e 00 00       	call   801fde <_panic>

00801165 <sfork>:

// Challenge!
int
sfork(void)
{
  801165:	f3 0f 1e fb          	endbr32 
  801169:	55                   	push   %ebp
  80116a:	89 e5                	mov    %esp,%ebp
  80116c:	83 ec 0c             	sub    $0xc,%esp
	panic("sfork not implemented");
  80116f:	68 45 28 80 00       	push   $0x802845
  801174:	68 b7 00 00 00       	push   $0xb7
  801179:	68 bb 27 80 00       	push   $0x8027bb
  80117e:	e8 5b 0e 00 00       	call   801fde <_panic>

00801183 <ipc_recv>:
//   If 'pg' is null, pass sys_ipc_recv a value that it will understand
//   as meaning "no page".  (Zero is not the right value, since that's
//   a perfectly valid place to map a page.)
int32_t
ipc_recv(envid_t *from_env_store, void *pg, int *perm_store)
{
  801183:	f3 0f 1e fb          	endbr32 
  801187:	55                   	push   %ebp
  801188:	89 e5                	mov    %esp,%ebp
  80118a:	56                   	push   %esi
  80118b:	53                   	push   %ebx
  80118c:	8b 75 08             	mov    0x8(%ebp),%esi
  80118f:	8b 45 0c             	mov    0xc(%ebp),%eax
  801192:	8b 5d 10             	mov    0x10(%ebp),%ebx
	// LAB 4: Your code here.
	int error;
	if(!pg)pg = (void *)UTOP; // 如果设置为UTOP，这个值其实可以比UTOP大，设置为这个值认为pg无效了，不会进行页面传递【共享页面的设置】，而是只进行值value的传递。
  801195:	85 c0                	test   %eax,%eax
  801197:	ba 00 00 c0 ee       	mov    $0xeec00000,%edx
  80119c:	0f 44 c2             	cmove  %edx,%eax
	if((error = sys_ipc_recv(pg)) < 0){
  80119f:	83 ec 0c             	sub    $0xc,%esp
  8011a2:	50                   	push   %eax
  8011a3:	e8 55 fc ff ff       	call   800dfd <sys_ipc_recv>
  8011a8:	83 c4 10             	add    $0x10,%esp
  8011ab:	85 c0                	test   %eax,%eax
  8011ad:	78 3f                	js     8011ee <ipc_recv+0x6b>
		if(from_env_store)*from_env_store = 0;
		if(perm_store)*perm_store = 0;
		return error;
	}

	thisenv = &envs[ENVX(sys_getenvid())]; // for lab4's challenge sfork().
  8011af:	e8 37 fa ff ff       	call   800beb <sys_getenvid>
  8011b4:	25 ff 03 00 00       	and    $0x3ff,%eax
  8011b9:	6b d0 7c             	imul   $0x7c,%eax,%edx
  8011bc:	81 c2 00 00 c0 ee    	add    $0xeec00000,%edx
  8011c2:	89 15 08 40 80 00    	mov    %edx,0x804008

	if(from_env_store)*from_env_store = thisenv->env_ipc_from;
  8011c8:	85 f6                	test   %esi,%esi
  8011ca:	74 05                	je     8011d1 <ipc_recv+0x4e>
  8011cc:	8b 42 74             	mov    0x74(%edx),%eax
  8011cf:	89 06                	mov    %eax,(%esi)
	if(perm_store)*perm_store = thisenv->env_ipc_perm;
  8011d1:	85 db                	test   %ebx,%ebx
  8011d3:	74 0a                	je     8011df <ipc_recv+0x5c>
  8011d5:	a1 08 40 80 00       	mov    0x804008,%eax
  8011da:	8b 40 78             	mov    0x78(%eax),%eax
  8011dd:	89 03                	mov    %eax,(%ebx)
	return thisenv->env_ipc_value;
  8011df:	a1 08 40 80 00       	mov    0x804008,%eax
  8011e4:	8b 40 70             	mov    0x70(%eax),%eax
}
  8011e7:	8d 65 f8             	lea    -0x8(%ebp),%esp
  8011ea:	5b                   	pop    %ebx
  8011eb:	5e                   	pop    %esi
  8011ec:	5d                   	pop    %ebp
  8011ed:	c3                   	ret    
		if(from_env_store)*from_env_store = 0;
  8011ee:	85 f6                	test   %esi,%esi
  8011f0:	74 06                	je     8011f8 <ipc_recv+0x75>
  8011f2:	c7 06 00 00 00 00    	movl   $0x0,(%esi)
		if(perm_store)*perm_store = 0;
  8011f8:	85 db                	test   %ebx,%ebx
  8011fa:	74 eb                	je     8011e7 <ipc_recv+0x64>
  8011fc:	c7 03 00 00 00 00    	movl   $0x0,(%ebx)
  801202:	eb e3                	jmp    8011e7 <ipc_recv+0x64>

00801204 <ipc_send>:
//   Use sys_yield() to be CPU-friendly.
//   If 'pg' is null, pass sys_ipc_try_send a value that it will understand
//   as meaning "no page".  (Zero is not the right value.)
void
ipc_send(envid_t to_env, uint32_t val, void *pg, int perm)
{
  801204:	f3 0f 1e fb          	endbr32 
  801208:	55                   	push   %ebp
  801209:	89 e5                	mov    %esp,%ebp
  80120b:	57                   	push   %edi
  80120c:	56                   	push   %esi
  80120d:	53                   	push   %ebx
  80120e:	83 ec 0c             	sub    $0xc,%esp
  801211:	8b 7d 08             	mov    0x8(%ebp),%edi
  801214:	8b 75 0c             	mov    0xc(%ebp),%esi
  801217:	8b 5d 10             	mov    0x10(%ebp),%ebx
	// LAB 4: Your code here.
	if(!pg)pg = (void *)UTOP; // 不会进行页面共享，只会sending message。
  80121a:	85 db                	test   %ebx,%ebx
  80121c:	b8 00 00 c0 ee       	mov    $0xeec00000,%eax
  801221:	0f 44 d8             	cmove  %eax,%ebx
	int error;
	// Keep trying until it succeeds.
	while((error = sys_ipc_try_send(to_env, val, pg, perm)) < 0){
  801224:	ff 75 14             	pushl  0x14(%ebp)
  801227:	53                   	push   %ebx
  801228:	56                   	push   %esi
  801229:	57                   	push   %edi
  80122a:	e8 a7 fb ff ff       	call   800dd6 <sys_ipc_try_send>
  80122f:	83 c4 10             	add    $0x10,%esp
  801232:	85 c0                	test   %eax,%eax
  801234:	79 1e                	jns    801254 <ipc_send+0x50>
        //如果error是没有接收者，那么就会继续尝试send
		if(error != -E_IPC_NOT_RECV){
  801236:	83 f8 f9             	cmp    $0xfffffff9,%eax
  801239:	75 07                	jne    801242 <ipc_send+0x3e>
			panic("sys_ipc_try_send:%e", error);
		}
        //但是不是一味的占用cpu，而是尝试一次就释放CPU，等待再次被调度，才会重新send，寻找receiver。
		sys_yield(); // To be CPU-friendly.
  80123b:	e8 ce f9 ff ff       	call   800c0e <sys_yield>
  801240:	eb e2                	jmp    801224 <ipc_send+0x20>
			panic("sys_ipc_try_send:%e", error);
  801242:	50                   	push   %eax
  801243:	68 5b 28 80 00       	push   $0x80285b
  801248:	6a 3b                	push   $0x3b
  80124a:	68 6f 28 80 00       	push   $0x80286f
  80124f:	e8 8a 0d 00 00       	call   801fde <_panic>
	}
}
  801254:	8d 65 f4             	lea    -0xc(%ebp),%esp
  801257:	5b                   	pop    %ebx
  801258:	5e                   	pop    %esi
  801259:	5f                   	pop    %edi
  80125a:	5d                   	pop    %ebp
  80125b:	c3                   	ret    

0080125c <ipc_find_env>:
// Find the first environment of the given type.  We'll use this to
// find special environments.
// Returns 0 if no such environment exists.
envid_t
ipc_find_env(enum EnvType type)
{
  80125c:	f3 0f 1e fb          	endbr32 
  801260:	55                   	push   %ebp
  801261:	89 e5                	mov    %esp,%ebp
  801263:	8b 4d 08             	mov    0x8(%ebp),%ecx
	int i;
	for (i = 0; i < NENV; i++)
  801266:	b8 00 00 00 00       	mov    $0x0,%eax
		if (envs[i].env_type == type)
  80126b:	6b d0 7c             	imul   $0x7c,%eax,%edx
  80126e:	81 c2 00 00 c0 ee    	add    $0xeec00000,%edx
  801274:	8b 52 50             	mov    0x50(%edx),%edx
  801277:	39 ca                	cmp    %ecx,%edx
  801279:	74 11                	je     80128c <ipc_find_env+0x30>
	for (i = 0; i < NENV; i++)
  80127b:	83 c0 01             	add    $0x1,%eax
  80127e:	3d 00 04 00 00       	cmp    $0x400,%eax
  801283:	75 e6                	jne    80126b <ipc_find_env+0xf>
			return envs[i].env_id;
	return 0;
  801285:	b8 00 00 00 00       	mov    $0x0,%eax
  80128a:	eb 0b                	jmp    801297 <ipc_find_env+0x3b>
			return envs[i].env_id;
  80128c:	6b c0 7c             	imul   $0x7c,%eax,%eax
  80128f:	05 00 00 c0 ee       	add    $0xeec00000,%eax
  801294:	8b 40 48             	mov    0x48(%eax),%eax
}
  801297:	5d                   	pop    %ebp
  801298:	c3                   	ret    

00801299 <fd2num>:
// File descriptor manipulators
// --------------------------------------------------------------

int
fd2num(struct Fd *fd)
{
  801299:	f3 0f 1e fb          	endbr32 
  80129d:	55                   	push   %ebp
  80129e:	89 e5                	mov    %esp,%ebp
	return ((uintptr_t) fd - FDTABLE) / PGSIZE;
  8012a0:	8b 45 08             	mov    0x8(%ebp),%eax
  8012a3:	05 00 00 00 30       	add    $0x30000000,%eax
  8012a8:	c1 e8 0c             	shr    $0xc,%eax
}
  8012ab:	5d                   	pop    %ebp
  8012ac:	c3                   	ret    

008012ad <fd2data>:

char*
fd2data(struct Fd *fd)
{
  8012ad:	f3 0f 1e fb          	endbr32 
  8012b1:	55                   	push   %ebp
  8012b2:	89 e5                	mov    %esp,%ebp
	return ((uintptr_t) fd - FDTABLE) / PGSIZE;
  8012b4:	8b 45 08             	mov    0x8(%ebp),%eax
  8012b7:	05 00 00 00 30       	add    $0x30000000,%eax
	return INDEX2DATA(fd2num(fd));
  8012bc:	25 00 f0 ff ff       	and    $0xfffff000,%eax
  8012c1:	2d 00 00 fe 2f       	sub    $0x2ffe0000,%eax
}
  8012c6:	5d                   	pop    %ebp
  8012c7:	c3                   	ret    

008012c8 <fd_alloc>:
// Returns 0 on success, < 0 on error.  Errors are:
//	-E_MAX_FD: no more file descriptors
// On error, *fd_store is set to 0.
int
fd_alloc(struct Fd **fd_store)
{
  8012c8:	f3 0f 1e fb          	endbr32 
  8012cc:	55                   	push   %ebp
  8012cd:	89 e5                	mov    %esp,%ebp
  8012cf:	b8 00 00 00 d0       	mov    $0xd0000000,%eax
	int i;
	struct Fd *fd;

	for (i = 0; i < MAXFD; i++) {
		fd = INDEX2FD(i);
		if ((uvpd[PDX(fd)] & PTE_P) == 0 || (uvpt[PGNUM(fd)] & PTE_P) == 0) {
  8012d4:	89 c2                	mov    %eax,%edx
  8012d6:	c1 ea 16             	shr    $0x16,%edx
  8012d9:	8b 14 95 00 d0 7b ef 	mov    -0x10843000(,%edx,4),%edx
  8012e0:	f6 c2 01             	test   $0x1,%dl
  8012e3:	74 2d                	je     801312 <fd_alloc+0x4a>
  8012e5:	89 c2                	mov    %eax,%edx
  8012e7:	c1 ea 0c             	shr    $0xc,%edx
  8012ea:	8b 14 95 00 00 40 ef 	mov    -0x10c00000(,%edx,4),%edx
  8012f1:	f6 c2 01             	test   $0x1,%dl
  8012f4:	74 1c                	je     801312 <fd_alloc+0x4a>
  8012f6:	05 00 10 00 00       	add    $0x1000,%eax
	for (i = 0; i < MAXFD; i++) {
  8012fb:	3d 00 00 02 d0       	cmp    $0xd0020000,%eax
  801300:	75 d2                	jne    8012d4 <fd_alloc+0xc>
			*fd_store = fd;
			return 0;
		}
	}
	*fd_store = 0;
  801302:	8b 45 08             	mov    0x8(%ebp),%eax
  801305:	c7 00 00 00 00 00    	movl   $0x0,(%eax)
	return -E_MAX_OPEN;
  80130b:	b8 f6 ff ff ff       	mov    $0xfffffff6,%eax
  801310:	eb 0a                	jmp    80131c <fd_alloc+0x54>
			*fd_store = fd;
  801312:	8b 4d 08             	mov    0x8(%ebp),%ecx
  801315:	89 01                	mov    %eax,(%ecx)
			return 0;
  801317:	b8 00 00 00 00       	mov    $0x0,%eax
}
  80131c:	5d                   	pop    %ebp
  80131d:	c3                   	ret    

0080131e <fd_lookup>:
// Returns 0 on success (the page is in range and mapped), < 0 on error.
// Errors are:
//	-E_INVAL: fdnum was either not in range or not mapped.
int
fd_lookup(int fdnum, struct Fd **fd_store)
{
  80131e:	f3 0f 1e fb          	endbr32 
  801322:	55                   	push   %ebp
  801323:	89 e5                	mov    %esp,%ebp
  801325:	8b 45 08             	mov    0x8(%ebp),%eax
	struct Fd *fd;

	if (fdnum < 0 || fdnum >= MAXFD) {
  801328:	83 f8 1f             	cmp    $0x1f,%eax
  80132b:	77 30                	ja     80135d <fd_lookup+0x3f>
		if (debug)
			cprintf("[%08x] bad fd %d\n", thisenv->env_id, fdnum);
		return -E_INVAL;
	}
	fd = INDEX2FD(fdnum);
  80132d:	c1 e0 0c             	shl    $0xc,%eax
  801330:	2d 00 00 00 30       	sub    $0x30000000,%eax
	if (!(uvpd[PDX(fd)] & PTE_P) || !(uvpt[PGNUM(fd)] & PTE_P)) {
  801335:	8b 15 00 dd 7b ef    	mov    0xef7bdd00,%edx
  80133b:	f6 c2 01             	test   $0x1,%dl
  80133e:	74 24                	je     801364 <fd_lookup+0x46>
  801340:	89 c2                	mov    %eax,%edx
  801342:	c1 ea 0c             	shr    $0xc,%edx
  801345:	8b 14 95 00 00 40 ef 	mov    -0x10c00000(,%edx,4),%edx
  80134c:	f6 c2 01             	test   $0x1,%dl
  80134f:	74 1a                	je     80136b <fd_lookup+0x4d>
		if (debug)
			cprintf("[%08x] closed fd %d\n", thisenv->env_id, fdnum);
		return -E_INVAL;
	}
	*fd_store = fd;
  801351:	8b 55 0c             	mov    0xc(%ebp),%edx
  801354:	89 02                	mov    %eax,(%edx)
	return 0;
  801356:	b8 00 00 00 00       	mov    $0x0,%eax
}
  80135b:	5d                   	pop    %ebp
  80135c:	c3                   	ret    
		return -E_INVAL;
  80135d:	b8 fd ff ff ff       	mov    $0xfffffffd,%eax
  801362:	eb f7                	jmp    80135b <fd_lookup+0x3d>
		return -E_INVAL;
  801364:	b8 fd ff ff ff       	mov    $0xfffffffd,%eax
  801369:	eb f0                	jmp    80135b <fd_lookup+0x3d>
  80136b:	b8 fd ff ff ff       	mov    $0xfffffffd,%eax
  801370:	eb e9                	jmp    80135b <fd_lookup+0x3d>

00801372 <dev_lookup>:
	0
};

int
dev_lookup(int dev_id, struct Dev **dev)
{
  801372:	f3 0f 1e fb          	endbr32 
  801376:	55                   	push   %ebp
  801377:	89 e5                	mov    %esp,%ebp
  801379:	83 ec 08             	sub    $0x8,%esp
  80137c:	8b 4d 08             	mov    0x8(%ebp),%ecx
  80137f:	ba f8 28 80 00       	mov    $0x8028f8,%edx
	int i;
	for (i = 0; devtab[i]; i++)
  801384:	b8 04 30 80 00       	mov    $0x803004,%eax
		if (devtab[i]->dev_id == dev_id) {
  801389:	39 08                	cmp    %ecx,(%eax)
  80138b:	74 33                	je     8013c0 <dev_lookup+0x4e>
  80138d:	83 c2 04             	add    $0x4,%edx
	for (i = 0; devtab[i]; i++)
  801390:	8b 02                	mov    (%edx),%eax
  801392:	85 c0                	test   %eax,%eax
  801394:	75 f3                	jne    801389 <dev_lookup+0x17>
			*dev = devtab[i];
			return 0;
		}
	cprintf("[%08x] unknown device type %d\n", thisenv->env_id, dev_id);
  801396:	a1 08 40 80 00       	mov    0x804008,%eax
  80139b:	8b 40 48             	mov    0x48(%eax),%eax
  80139e:	83 ec 04             	sub    $0x4,%esp
  8013a1:	51                   	push   %ecx
  8013a2:	50                   	push   %eax
  8013a3:	68 7c 28 80 00       	push   $0x80287c
  8013a8:	e8 69 ee ff ff       	call   800216 <cprintf>
	*dev = 0;
  8013ad:	8b 45 0c             	mov    0xc(%ebp),%eax
  8013b0:	c7 00 00 00 00 00    	movl   $0x0,(%eax)
	return -E_INVAL;
  8013b6:	83 c4 10             	add    $0x10,%esp
  8013b9:	b8 fd ff ff ff       	mov    $0xfffffffd,%eax
}
  8013be:	c9                   	leave  
  8013bf:	c3                   	ret    
			*dev = devtab[i];
  8013c0:	8b 4d 0c             	mov    0xc(%ebp),%ecx
  8013c3:	89 01                	mov    %eax,(%ecx)
			return 0;
  8013c5:	b8 00 00 00 00       	mov    $0x0,%eax
  8013ca:	eb f2                	jmp    8013be <dev_lookup+0x4c>

008013cc <fd_close>:
{
  8013cc:	f3 0f 1e fb          	endbr32 
  8013d0:	55                   	push   %ebp
  8013d1:	89 e5                	mov    %esp,%ebp
  8013d3:	57                   	push   %edi
  8013d4:	56                   	push   %esi
  8013d5:	53                   	push   %ebx
  8013d6:	83 ec 24             	sub    $0x24,%esp
  8013d9:	8b 75 08             	mov    0x8(%ebp),%esi
  8013dc:	8b 7d 0c             	mov    0xc(%ebp),%edi
	if ((r = fd_lookup(fd2num(fd), &fd2)) < 0
  8013df:	8d 45 e4             	lea    -0x1c(%ebp),%eax
  8013e2:	50                   	push   %eax
	return ((uintptr_t) fd - FDTABLE) / PGSIZE;
  8013e3:	8d 86 00 00 00 30    	lea    0x30000000(%esi),%eax
  8013e9:	c1 e8 0c             	shr    $0xc,%eax
	if ((r = fd_lookup(fd2num(fd), &fd2)) < 0
  8013ec:	50                   	push   %eax
  8013ed:	e8 2c ff ff ff       	call   80131e <fd_lookup>
  8013f2:	89 c3                	mov    %eax,%ebx
  8013f4:	83 c4 10             	add    $0x10,%esp
  8013f7:	85 c0                	test   %eax,%eax
  8013f9:	78 05                	js     801400 <fd_close+0x34>
	    || fd != fd2)
  8013fb:	39 75 e4             	cmp    %esi,-0x1c(%ebp)
  8013fe:	74 16                	je     801416 <fd_close+0x4a>
		return (must_exist ? r : 0);
  801400:	89 f8                	mov    %edi,%eax
  801402:	84 c0                	test   %al,%al
  801404:	b8 00 00 00 00       	mov    $0x0,%eax
  801409:	0f 44 d8             	cmove  %eax,%ebx
}
  80140c:	89 d8                	mov    %ebx,%eax
  80140e:	8d 65 f4             	lea    -0xc(%ebp),%esp
  801411:	5b                   	pop    %ebx
  801412:	5e                   	pop    %esi
  801413:	5f                   	pop    %edi
  801414:	5d                   	pop    %ebp
  801415:	c3                   	ret    
	if ((r = dev_lookup(fd->fd_dev_id, &dev)) >= 0) {
  801416:	83 ec 08             	sub    $0x8,%esp
  801419:	8d 45 e0             	lea    -0x20(%ebp),%eax
  80141c:	50                   	push   %eax
  80141d:	ff 36                	pushl  (%esi)
  80141f:	e8 4e ff ff ff       	call   801372 <dev_lookup>
  801424:	89 c3                	mov    %eax,%ebx
  801426:	83 c4 10             	add    $0x10,%esp
  801429:	85 c0                	test   %eax,%eax
  80142b:	78 1a                	js     801447 <fd_close+0x7b>
		if (dev->dev_close)
  80142d:	8b 45 e0             	mov    -0x20(%ebp),%eax
  801430:	8b 40 10             	mov    0x10(%eax),%eax
			r = 0;
  801433:	bb 00 00 00 00       	mov    $0x0,%ebx
		if (dev->dev_close)
  801438:	85 c0                	test   %eax,%eax
  80143a:	74 0b                	je     801447 <fd_close+0x7b>
			r = (*dev->dev_close)(fd);
  80143c:	83 ec 0c             	sub    $0xc,%esp
  80143f:	56                   	push   %esi
  801440:	ff d0                	call   *%eax
  801442:	89 c3                	mov    %eax,%ebx
  801444:	83 c4 10             	add    $0x10,%esp
	(void) sys_page_unmap(0, fd);
  801447:	83 ec 08             	sub    $0x8,%esp
  80144a:	56                   	push   %esi
  80144b:	6a 00                	push   $0x0
  80144d:	e8 6c f8 ff ff       	call   800cbe <sys_page_unmap>
	return r;
  801452:	83 c4 10             	add    $0x10,%esp
  801455:	eb b5                	jmp    80140c <fd_close+0x40>

00801457 <close>:

int
close(int fdnum)
{
  801457:	f3 0f 1e fb          	endbr32 
  80145b:	55                   	push   %ebp
  80145c:	89 e5                	mov    %esp,%ebp
  80145e:	83 ec 20             	sub    $0x20,%esp
	struct Fd *fd;
	int r;

	if ((r = fd_lookup(fdnum, &fd)) < 0)
  801461:	8d 45 f4             	lea    -0xc(%ebp),%eax
  801464:	50                   	push   %eax
  801465:	ff 75 08             	pushl  0x8(%ebp)
  801468:	e8 b1 fe ff ff       	call   80131e <fd_lookup>
  80146d:	83 c4 10             	add    $0x10,%esp
  801470:	85 c0                	test   %eax,%eax
  801472:	79 02                	jns    801476 <close+0x1f>
		return r;
	else
		return fd_close(fd, 1);
}
  801474:	c9                   	leave  
  801475:	c3                   	ret    
		return fd_close(fd, 1);
  801476:	83 ec 08             	sub    $0x8,%esp
  801479:	6a 01                	push   $0x1
  80147b:	ff 75 f4             	pushl  -0xc(%ebp)
  80147e:	e8 49 ff ff ff       	call   8013cc <fd_close>
  801483:	83 c4 10             	add    $0x10,%esp
  801486:	eb ec                	jmp    801474 <close+0x1d>

00801488 <close_all>:

void
close_all(void)
{
  801488:	f3 0f 1e fb          	endbr32 
  80148c:	55                   	push   %ebp
  80148d:	89 e5                	mov    %esp,%ebp
  80148f:	53                   	push   %ebx
  801490:	83 ec 04             	sub    $0x4,%esp
	int i;
	for (i = 0; i < MAXFD; i++)
  801493:	bb 00 00 00 00       	mov    $0x0,%ebx
		close(i);
  801498:	83 ec 0c             	sub    $0xc,%esp
  80149b:	53                   	push   %ebx
  80149c:	e8 b6 ff ff ff       	call   801457 <close>
	for (i = 0; i < MAXFD; i++)
  8014a1:	83 c3 01             	add    $0x1,%ebx
  8014a4:	83 c4 10             	add    $0x10,%esp
  8014a7:	83 fb 20             	cmp    $0x20,%ebx
  8014aa:	75 ec                	jne    801498 <close_all+0x10>
}
  8014ac:	8b 5d fc             	mov    -0x4(%ebp),%ebx
  8014af:	c9                   	leave  
  8014b0:	c3                   	ret    

008014b1 <dup>:
// file and the file offset of the other.
// Closes any previously open file descriptor at 'newfdnum'.
// This is implemented using virtual memory tricks (of course!).
int
dup(int oldfdnum, int newfdnum)
{
  8014b1:	f3 0f 1e fb          	endbr32 
  8014b5:	55                   	push   %ebp
  8014b6:	89 e5                	mov    %esp,%ebp
  8014b8:	57                   	push   %edi
  8014b9:	56                   	push   %esi
  8014ba:	53                   	push   %ebx
  8014bb:	83 ec 24             	sub    $0x24,%esp
	int r;
	char *ova, *nva;
	pte_t pte;
	struct Fd *oldfd, *newfd;

	if ((r = fd_lookup(oldfdnum, &oldfd)) < 0)
  8014be:	8d 45 e4             	lea    -0x1c(%ebp),%eax
  8014c1:	50                   	push   %eax
  8014c2:	ff 75 08             	pushl  0x8(%ebp)
  8014c5:	e8 54 fe ff ff       	call   80131e <fd_lookup>
  8014ca:	89 c3                	mov    %eax,%ebx
  8014cc:	83 c4 10             	add    $0x10,%esp
  8014cf:	85 c0                	test   %eax,%eax
  8014d1:	0f 88 81 00 00 00    	js     801558 <dup+0xa7>
		return r;
	close(newfdnum);
  8014d7:	83 ec 0c             	sub    $0xc,%esp
  8014da:	ff 75 0c             	pushl  0xc(%ebp)
  8014dd:	e8 75 ff ff ff       	call   801457 <close>

	newfd = INDEX2FD(newfdnum);
  8014e2:	8b 75 0c             	mov    0xc(%ebp),%esi
  8014e5:	c1 e6 0c             	shl    $0xc,%esi
  8014e8:	81 ee 00 00 00 30    	sub    $0x30000000,%esi
	ova = fd2data(oldfd);
  8014ee:	83 c4 04             	add    $0x4,%esp
  8014f1:	ff 75 e4             	pushl  -0x1c(%ebp)
  8014f4:	e8 b4 fd ff ff       	call   8012ad <fd2data>
  8014f9:	89 c3                	mov    %eax,%ebx
	nva = fd2data(newfd);
  8014fb:	89 34 24             	mov    %esi,(%esp)
  8014fe:	e8 aa fd ff ff       	call   8012ad <fd2data>
  801503:	83 c4 10             	add    $0x10,%esp
  801506:	89 c7                	mov    %eax,%edi

	if ((uvpd[PDX(ova)] & PTE_P) && (uvpt[PGNUM(ova)] & PTE_P))
  801508:	89 d8                	mov    %ebx,%eax
  80150a:	c1 e8 16             	shr    $0x16,%eax
  80150d:	8b 04 85 00 d0 7b ef 	mov    -0x10843000(,%eax,4),%eax
  801514:	a8 01                	test   $0x1,%al
  801516:	74 11                	je     801529 <dup+0x78>
  801518:	89 d8                	mov    %ebx,%eax
  80151a:	c1 e8 0c             	shr    $0xc,%eax
  80151d:	8b 14 85 00 00 40 ef 	mov    -0x10c00000(,%eax,4),%edx
  801524:	f6 c2 01             	test   $0x1,%dl
  801527:	75 39                	jne    801562 <dup+0xb1>
		if ((r = sys_page_map(0, ova, 0, nva, uvpt[PGNUM(ova)] & PTE_SYSCALL)) < 0)
			goto err;
	if ((r = sys_page_map(0, oldfd, 0, newfd, uvpt[PGNUM(oldfd)] & PTE_SYSCALL)) < 0)
  801529:	8b 55 e4             	mov    -0x1c(%ebp),%edx
  80152c:	89 d0                	mov    %edx,%eax
  80152e:	c1 e8 0c             	shr    $0xc,%eax
  801531:	8b 04 85 00 00 40 ef 	mov    -0x10c00000(,%eax,4),%eax
  801538:	83 ec 0c             	sub    $0xc,%esp
  80153b:	25 07 0e 00 00       	and    $0xe07,%eax
  801540:	50                   	push   %eax
  801541:	56                   	push   %esi
  801542:	6a 00                	push   $0x0
  801544:	52                   	push   %edx
  801545:	6a 00                	push   $0x0
  801547:	e8 2c f7 ff ff       	call   800c78 <sys_page_map>
  80154c:	89 c3                	mov    %eax,%ebx
  80154e:	83 c4 20             	add    $0x20,%esp
  801551:	85 c0                	test   %eax,%eax
  801553:	78 31                	js     801586 <dup+0xd5>
		goto err;

	return newfdnum;
  801555:	8b 5d 0c             	mov    0xc(%ebp),%ebx

err:
	sys_page_unmap(0, newfd);
	sys_page_unmap(0, nva);
	return r;
}
  801558:	89 d8                	mov    %ebx,%eax
  80155a:	8d 65 f4             	lea    -0xc(%ebp),%esp
  80155d:	5b                   	pop    %ebx
  80155e:	5e                   	pop    %esi
  80155f:	5f                   	pop    %edi
  801560:	5d                   	pop    %ebp
  801561:	c3                   	ret    
		if ((r = sys_page_map(0, ova, 0, nva, uvpt[PGNUM(ova)] & PTE_SYSCALL)) < 0)
  801562:	8b 04 85 00 00 40 ef 	mov    -0x10c00000(,%eax,4),%eax
  801569:	83 ec 0c             	sub    $0xc,%esp
  80156c:	25 07 0e 00 00       	and    $0xe07,%eax
  801571:	50                   	push   %eax
  801572:	57                   	push   %edi
  801573:	6a 00                	push   $0x0
  801575:	53                   	push   %ebx
  801576:	6a 00                	push   $0x0
  801578:	e8 fb f6 ff ff       	call   800c78 <sys_page_map>
  80157d:	89 c3                	mov    %eax,%ebx
  80157f:	83 c4 20             	add    $0x20,%esp
  801582:	85 c0                	test   %eax,%eax
  801584:	79 a3                	jns    801529 <dup+0x78>
	sys_page_unmap(0, newfd);
  801586:	83 ec 08             	sub    $0x8,%esp
  801589:	56                   	push   %esi
  80158a:	6a 00                	push   $0x0
  80158c:	e8 2d f7 ff ff       	call   800cbe <sys_page_unmap>
	sys_page_unmap(0, nva);
  801591:	83 c4 08             	add    $0x8,%esp
  801594:	57                   	push   %edi
  801595:	6a 00                	push   $0x0
  801597:	e8 22 f7 ff ff       	call   800cbe <sys_page_unmap>
	return r;
  80159c:	83 c4 10             	add    $0x10,%esp
  80159f:	eb b7                	jmp    801558 <dup+0xa7>

008015a1 <read>:

ssize_t
read(int fdnum, void *buf, size_t n)
{
  8015a1:	f3 0f 1e fb          	endbr32 
  8015a5:	55                   	push   %ebp
  8015a6:	89 e5                	mov    %esp,%ebp
  8015a8:	53                   	push   %ebx
  8015a9:	83 ec 1c             	sub    $0x1c,%esp
  8015ac:	8b 5d 08             	mov    0x8(%ebp),%ebx
	int r;
	struct Dev *dev;
	struct Fd *fd;

	if ((r = fd_lookup(fdnum, &fd)) < 0
  8015af:	8d 45 f0             	lea    -0x10(%ebp),%eax
  8015b2:	50                   	push   %eax
  8015b3:	53                   	push   %ebx
  8015b4:	e8 65 fd ff ff       	call   80131e <fd_lookup>
  8015b9:	83 c4 10             	add    $0x10,%esp
  8015bc:	85 c0                	test   %eax,%eax
  8015be:	78 3f                	js     8015ff <read+0x5e>
	    || (r = dev_lookup(fd->fd_dev_id, &dev)) < 0)
  8015c0:	83 ec 08             	sub    $0x8,%esp
  8015c3:	8d 45 f4             	lea    -0xc(%ebp),%eax
  8015c6:	50                   	push   %eax
  8015c7:	8b 45 f0             	mov    -0x10(%ebp),%eax
  8015ca:	ff 30                	pushl  (%eax)
  8015cc:	e8 a1 fd ff ff       	call   801372 <dev_lookup>
  8015d1:	83 c4 10             	add    $0x10,%esp
  8015d4:	85 c0                	test   %eax,%eax
  8015d6:	78 27                	js     8015ff <read+0x5e>
		return r;
	if ((fd->fd_omode & O_ACCMODE) == O_WRONLY) {
  8015d8:	8b 55 f0             	mov    -0x10(%ebp),%edx
  8015db:	8b 42 08             	mov    0x8(%edx),%eax
  8015de:	83 e0 03             	and    $0x3,%eax
  8015e1:	83 f8 01             	cmp    $0x1,%eax
  8015e4:	74 1e                	je     801604 <read+0x63>
		cprintf("[%08x] read %d -- bad mode\n", thisenv->env_id, fdnum);
		return -E_INVAL;
	}
	if (!dev->dev_read)
  8015e6:	8b 45 f4             	mov    -0xc(%ebp),%eax
  8015e9:	8b 40 08             	mov    0x8(%eax),%eax
  8015ec:	85 c0                	test   %eax,%eax
  8015ee:	74 35                	je     801625 <read+0x84>
		return -E_NOT_SUPP;
	return (*dev->dev_read)(fd, buf, n);
  8015f0:	83 ec 04             	sub    $0x4,%esp
  8015f3:	ff 75 10             	pushl  0x10(%ebp)
  8015f6:	ff 75 0c             	pushl  0xc(%ebp)
  8015f9:	52                   	push   %edx
  8015fa:	ff d0                	call   *%eax
  8015fc:	83 c4 10             	add    $0x10,%esp
}
  8015ff:	8b 5d fc             	mov    -0x4(%ebp),%ebx
  801602:	c9                   	leave  
  801603:	c3                   	ret    
		cprintf("[%08x] read %d -- bad mode\n", thisenv->env_id, fdnum);
  801604:	a1 08 40 80 00       	mov    0x804008,%eax
  801609:	8b 40 48             	mov    0x48(%eax),%eax
  80160c:	83 ec 04             	sub    $0x4,%esp
  80160f:	53                   	push   %ebx
  801610:	50                   	push   %eax
  801611:	68 bd 28 80 00       	push   $0x8028bd
  801616:	e8 fb eb ff ff       	call   800216 <cprintf>
		return -E_INVAL;
  80161b:	83 c4 10             	add    $0x10,%esp
  80161e:	b8 fd ff ff ff       	mov    $0xfffffffd,%eax
  801623:	eb da                	jmp    8015ff <read+0x5e>
		return -E_NOT_SUPP;
  801625:	b8 f1 ff ff ff       	mov    $0xfffffff1,%eax
  80162a:	eb d3                	jmp    8015ff <read+0x5e>

0080162c <readn>:

ssize_t
readn(int fdnum, void *buf, size_t n)
{
  80162c:	f3 0f 1e fb          	endbr32 
  801630:	55                   	push   %ebp
  801631:	89 e5                	mov    %esp,%ebp
  801633:	57                   	push   %edi
  801634:	56                   	push   %esi
  801635:	53                   	push   %ebx
  801636:	83 ec 0c             	sub    $0xc,%esp
  801639:	8b 7d 08             	mov    0x8(%ebp),%edi
  80163c:	8b 75 10             	mov    0x10(%ebp),%esi
	int m, tot;

	for (tot = 0; tot < n; tot += m) {
  80163f:	bb 00 00 00 00       	mov    $0x0,%ebx
  801644:	eb 02                	jmp    801648 <readn+0x1c>
  801646:	01 c3                	add    %eax,%ebx
  801648:	39 f3                	cmp    %esi,%ebx
  80164a:	73 21                	jae    80166d <readn+0x41>
		m = read(fdnum, (char*)buf + tot, n - tot);
  80164c:	83 ec 04             	sub    $0x4,%esp
  80164f:	89 f0                	mov    %esi,%eax
  801651:	29 d8                	sub    %ebx,%eax
  801653:	50                   	push   %eax
  801654:	89 d8                	mov    %ebx,%eax
  801656:	03 45 0c             	add    0xc(%ebp),%eax
  801659:	50                   	push   %eax
  80165a:	57                   	push   %edi
  80165b:	e8 41 ff ff ff       	call   8015a1 <read>
		if (m < 0)
  801660:	83 c4 10             	add    $0x10,%esp
  801663:	85 c0                	test   %eax,%eax
  801665:	78 04                	js     80166b <readn+0x3f>
			return m;
		if (m == 0)
  801667:	75 dd                	jne    801646 <readn+0x1a>
  801669:	eb 02                	jmp    80166d <readn+0x41>
		m = read(fdnum, (char*)buf + tot, n - tot);
  80166b:	89 c3                	mov    %eax,%ebx
			break;
	}
	return tot;
}
  80166d:	89 d8                	mov    %ebx,%eax
  80166f:	8d 65 f4             	lea    -0xc(%ebp),%esp
  801672:	5b                   	pop    %ebx
  801673:	5e                   	pop    %esi
  801674:	5f                   	pop    %edi
  801675:	5d                   	pop    %ebp
  801676:	c3                   	ret    

00801677 <write>:

ssize_t
write(int fdnum, const void *buf, size_t n)
{
  801677:	f3 0f 1e fb          	endbr32 
  80167b:	55                   	push   %ebp
  80167c:	89 e5                	mov    %esp,%ebp
  80167e:	53                   	push   %ebx
  80167f:	83 ec 1c             	sub    $0x1c,%esp
  801682:	8b 5d 08             	mov    0x8(%ebp),%ebx
	int r;
	struct Dev *dev;
	struct Fd *fd;

	if ((r = fd_lookup(fdnum, &fd)) < 0
  801685:	8d 45 f0             	lea    -0x10(%ebp),%eax
  801688:	50                   	push   %eax
  801689:	53                   	push   %ebx
  80168a:	e8 8f fc ff ff       	call   80131e <fd_lookup>
  80168f:	83 c4 10             	add    $0x10,%esp
  801692:	85 c0                	test   %eax,%eax
  801694:	78 3a                	js     8016d0 <write+0x59>
	    || (r = dev_lookup(fd->fd_dev_id, &dev)) < 0)
  801696:	83 ec 08             	sub    $0x8,%esp
  801699:	8d 45 f4             	lea    -0xc(%ebp),%eax
  80169c:	50                   	push   %eax
  80169d:	8b 45 f0             	mov    -0x10(%ebp),%eax
  8016a0:	ff 30                	pushl  (%eax)
  8016a2:	e8 cb fc ff ff       	call   801372 <dev_lookup>
  8016a7:	83 c4 10             	add    $0x10,%esp
  8016aa:	85 c0                	test   %eax,%eax
  8016ac:	78 22                	js     8016d0 <write+0x59>
		return r;
	if ((fd->fd_omode & O_ACCMODE) == O_RDONLY) {
  8016ae:	8b 45 f0             	mov    -0x10(%ebp),%eax
  8016b1:	f6 40 08 03          	testb  $0x3,0x8(%eax)
  8016b5:	74 1e                	je     8016d5 <write+0x5e>
		return -E_INVAL;
	}
	if (debug)
		cprintf("write %d %p %d via dev %s\n",
			fdnum, buf, n, dev->dev_name);
	if (!dev->dev_write)
  8016b7:	8b 55 f4             	mov    -0xc(%ebp),%edx
  8016ba:	8b 52 0c             	mov    0xc(%edx),%edx
  8016bd:	85 d2                	test   %edx,%edx
  8016bf:	74 35                	je     8016f6 <write+0x7f>
		return -E_NOT_SUPP;
	return (*dev->dev_write)(fd, buf, n);
  8016c1:	83 ec 04             	sub    $0x4,%esp
  8016c4:	ff 75 10             	pushl  0x10(%ebp)
  8016c7:	ff 75 0c             	pushl  0xc(%ebp)
  8016ca:	50                   	push   %eax
  8016cb:	ff d2                	call   *%edx
  8016cd:	83 c4 10             	add    $0x10,%esp
}
  8016d0:	8b 5d fc             	mov    -0x4(%ebp),%ebx
  8016d3:	c9                   	leave  
  8016d4:	c3                   	ret    
		cprintf("[%08x] write %d -- bad mode\n", thisenv->env_id, fdnum);
  8016d5:	a1 08 40 80 00       	mov    0x804008,%eax
  8016da:	8b 40 48             	mov    0x48(%eax),%eax
  8016dd:	83 ec 04             	sub    $0x4,%esp
  8016e0:	53                   	push   %ebx
  8016e1:	50                   	push   %eax
  8016e2:	68 d9 28 80 00       	push   $0x8028d9
  8016e7:	e8 2a eb ff ff       	call   800216 <cprintf>
		return -E_INVAL;
  8016ec:	83 c4 10             	add    $0x10,%esp
  8016ef:	b8 fd ff ff ff       	mov    $0xfffffffd,%eax
  8016f4:	eb da                	jmp    8016d0 <write+0x59>
		return -E_NOT_SUPP;
  8016f6:	b8 f1 ff ff ff       	mov    $0xfffffff1,%eax
  8016fb:	eb d3                	jmp    8016d0 <write+0x59>

008016fd <seek>:

int
seek(int fdnum, off_t offset)
{
  8016fd:	f3 0f 1e fb          	endbr32 
  801701:	55                   	push   %ebp
  801702:	89 e5                	mov    %esp,%ebp
  801704:	83 ec 20             	sub    $0x20,%esp
	int r;
	struct Fd *fd;

	if ((r = fd_lookup(fdnum, &fd)) < 0)
  801707:	8d 45 f4             	lea    -0xc(%ebp),%eax
  80170a:	50                   	push   %eax
  80170b:	ff 75 08             	pushl  0x8(%ebp)
  80170e:	e8 0b fc ff ff       	call   80131e <fd_lookup>
  801713:	83 c4 10             	add    $0x10,%esp
  801716:	85 c0                	test   %eax,%eax
  801718:	78 0e                	js     801728 <seek+0x2b>
		return r;
	fd->fd_offset = offset;
  80171a:	8b 55 0c             	mov    0xc(%ebp),%edx
  80171d:	8b 45 f4             	mov    -0xc(%ebp),%eax
  801720:	89 50 04             	mov    %edx,0x4(%eax)
	return 0;
  801723:	b8 00 00 00 00       	mov    $0x0,%eax
}
  801728:	c9                   	leave  
  801729:	c3                   	ret    

0080172a <ftruncate>:

int
ftruncate(int fdnum, off_t newsize)
{
  80172a:	f3 0f 1e fb          	endbr32 
  80172e:	55                   	push   %ebp
  80172f:	89 e5                	mov    %esp,%ebp
  801731:	53                   	push   %ebx
  801732:	83 ec 1c             	sub    $0x1c,%esp
  801735:	8b 5d 08             	mov    0x8(%ebp),%ebx
	int r;
	struct Dev *dev;
	struct Fd *fd;
	if ((r = fd_lookup(fdnum, &fd)) < 0
  801738:	8d 45 f0             	lea    -0x10(%ebp),%eax
  80173b:	50                   	push   %eax
  80173c:	53                   	push   %ebx
  80173d:	e8 dc fb ff ff       	call   80131e <fd_lookup>
  801742:	83 c4 10             	add    $0x10,%esp
  801745:	85 c0                	test   %eax,%eax
  801747:	78 37                	js     801780 <ftruncate+0x56>
	    || (r = dev_lookup(fd->fd_dev_id, &dev)) < 0)
  801749:	83 ec 08             	sub    $0x8,%esp
  80174c:	8d 45 f4             	lea    -0xc(%ebp),%eax
  80174f:	50                   	push   %eax
  801750:	8b 45 f0             	mov    -0x10(%ebp),%eax
  801753:	ff 30                	pushl  (%eax)
  801755:	e8 18 fc ff ff       	call   801372 <dev_lookup>
  80175a:	83 c4 10             	add    $0x10,%esp
  80175d:	85 c0                	test   %eax,%eax
  80175f:	78 1f                	js     801780 <ftruncate+0x56>
		return r;
	if ((fd->fd_omode & O_ACCMODE) == O_RDONLY) {
  801761:	8b 45 f0             	mov    -0x10(%ebp),%eax
  801764:	f6 40 08 03          	testb  $0x3,0x8(%eax)
  801768:	74 1b                	je     801785 <ftruncate+0x5b>
		cprintf("[%08x] ftruncate %d -- bad mode\n",
			thisenv->env_id, fdnum);
		return -E_INVAL;
	}
	if (!dev->dev_trunc)
  80176a:	8b 55 f4             	mov    -0xc(%ebp),%edx
  80176d:	8b 52 18             	mov    0x18(%edx),%edx
  801770:	85 d2                	test   %edx,%edx
  801772:	74 32                	je     8017a6 <ftruncate+0x7c>
		return -E_NOT_SUPP;
	return (*dev->dev_trunc)(fd, newsize);
  801774:	83 ec 08             	sub    $0x8,%esp
  801777:	ff 75 0c             	pushl  0xc(%ebp)
  80177a:	50                   	push   %eax
  80177b:	ff d2                	call   *%edx
  80177d:	83 c4 10             	add    $0x10,%esp
}
  801780:	8b 5d fc             	mov    -0x4(%ebp),%ebx
  801783:	c9                   	leave  
  801784:	c3                   	ret    
			thisenv->env_id, fdnum);
  801785:	a1 08 40 80 00       	mov    0x804008,%eax
		cprintf("[%08x] ftruncate %d -- bad mode\n",
  80178a:	8b 40 48             	mov    0x48(%eax),%eax
  80178d:	83 ec 04             	sub    $0x4,%esp
  801790:	53                   	push   %ebx
  801791:	50                   	push   %eax
  801792:	68 9c 28 80 00       	push   $0x80289c
  801797:	e8 7a ea ff ff       	call   800216 <cprintf>
		return -E_INVAL;
  80179c:	83 c4 10             	add    $0x10,%esp
  80179f:	b8 fd ff ff ff       	mov    $0xfffffffd,%eax
  8017a4:	eb da                	jmp    801780 <ftruncate+0x56>
		return -E_NOT_SUPP;
  8017a6:	b8 f1 ff ff ff       	mov    $0xfffffff1,%eax
  8017ab:	eb d3                	jmp    801780 <ftruncate+0x56>

008017ad <fstat>:

int
fstat(int fdnum, struct Stat *stat)
{
  8017ad:	f3 0f 1e fb          	endbr32 
  8017b1:	55                   	push   %ebp
  8017b2:	89 e5                	mov    %esp,%ebp
  8017b4:	53                   	push   %ebx
  8017b5:	83 ec 1c             	sub    $0x1c,%esp
  8017b8:	8b 5d 0c             	mov    0xc(%ebp),%ebx
	int r;
	struct Dev *dev;
	struct Fd *fd;

	if ((r = fd_lookup(fdnum, &fd)) < 0
  8017bb:	8d 45 f0             	lea    -0x10(%ebp),%eax
  8017be:	50                   	push   %eax
  8017bf:	ff 75 08             	pushl  0x8(%ebp)
  8017c2:	e8 57 fb ff ff       	call   80131e <fd_lookup>
  8017c7:	83 c4 10             	add    $0x10,%esp
  8017ca:	85 c0                	test   %eax,%eax
  8017cc:	78 4b                	js     801819 <fstat+0x6c>
	    || (r = dev_lookup(fd->fd_dev_id, &dev)) < 0)
  8017ce:	83 ec 08             	sub    $0x8,%esp
  8017d1:	8d 45 f4             	lea    -0xc(%ebp),%eax
  8017d4:	50                   	push   %eax
  8017d5:	8b 45 f0             	mov    -0x10(%ebp),%eax
  8017d8:	ff 30                	pushl  (%eax)
  8017da:	e8 93 fb ff ff       	call   801372 <dev_lookup>
  8017df:	83 c4 10             	add    $0x10,%esp
  8017e2:	85 c0                	test   %eax,%eax
  8017e4:	78 33                	js     801819 <fstat+0x6c>
		return r;
	if (!dev->dev_stat)
  8017e6:	8b 45 f4             	mov    -0xc(%ebp),%eax
  8017e9:	83 78 14 00          	cmpl   $0x0,0x14(%eax)
  8017ed:	74 2f                	je     80181e <fstat+0x71>
		return -E_NOT_SUPP;
	stat->st_name[0] = 0;
  8017ef:	c6 03 00             	movb   $0x0,(%ebx)
	stat->st_size = 0;
  8017f2:	c7 83 80 00 00 00 00 	movl   $0x0,0x80(%ebx)
  8017f9:	00 00 00 
	stat->st_isdir = 0;
  8017fc:	c7 83 84 00 00 00 00 	movl   $0x0,0x84(%ebx)
  801803:	00 00 00 
	stat->st_dev = dev;
  801806:	89 83 88 00 00 00    	mov    %eax,0x88(%ebx)
	return (*dev->dev_stat)(fd, stat);
  80180c:	83 ec 08             	sub    $0x8,%esp
  80180f:	53                   	push   %ebx
  801810:	ff 75 f0             	pushl  -0x10(%ebp)
  801813:	ff 50 14             	call   *0x14(%eax)
  801816:	83 c4 10             	add    $0x10,%esp
}
  801819:	8b 5d fc             	mov    -0x4(%ebp),%ebx
  80181c:	c9                   	leave  
  80181d:	c3                   	ret    
		return -E_NOT_SUPP;
  80181e:	b8 f1 ff ff ff       	mov    $0xfffffff1,%eax
  801823:	eb f4                	jmp    801819 <fstat+0x6c>

00801825 <stat>:

int
stat(const char *path, struct Stat *stat)
{
  801825:	f3 0f 1e fb          	endbr32 
  801829:	55                   	push   %ebp
  80182a:	89 e5                	mov    %esp,%ebp
  80182c:	56                   	push   %esi
  80182d:	53                   	push   %ebx
	int fd, r;

	if ((fd = open(path, O_RDONLY)) < 0)
  80182e:	83 ec 08             	sub    $0x8,%esp
  801831:	6a 00                	push   $0x0
  801833:	ff 75 08             	pushl  0x8(%ebp)
  801836:	e8 fb 01 00 00       	call   801a36 <open>
  80183b:	89 c3                	mov    %eax,%ebx
  80183d:	83 c4 10             	add    $0x10,%esp
  801840:	85 c0                	test   %eax,%eax
  801842:	78 1b                	js     80185f <stat+0x3a>
		return fd;
	r = fstat(fd, stat);
  801844:	83 ec 08             	sub    $0x8,%esp
  801847:	ff 75 0c             	pushl  0xc(%ebp)
  80184a:	50                   	push   %eax
  80184b:	e8 5d ff ff ff       	call   8017ad <fstat>
  801850:	89 c6                	mov    %eax,%esi
	close(fd);
  801852:	89 1c 24             	mov    %ebx,(%esp)
  801855:	e8 fd fb ff ff       	call   801457 <close>
	return r;
  80185a:	83 c4 10             	add    $0x10,%esp
  80185d:	89 f3                	mov    %esi,%ebx
}
  80185f:	89 d8                	mov    %ebx,%eax
  801861:	8d 65 f8             	lea    -0x8(%ebp),%esp
  801864:	5b                   	pop    %ebx
  801865:	5e                   	pop    %esi
  801866:	5d                   	pop    %ebp
  801867:	c3                   	ret    

00801868 <fsipc>:
// type: request code, passed as the simple integer IPC value.
// dstva: virtual address at which to receive reply page, 0 if none.
// Returns result from the file server.
static int
fsipc(unsigned type, void *dstva)
{
  801868:	55                   	push   %ebp
  801869:	89 e5                	mov    %esp,%ebp
  80186b:	56                   	push   %esi
  80186c:	53                   	push   %ebx
  80186d:	89 c6                	mov    %eax,%esi
  80186f:	89 d3                	mov    %edx,%ebx
	static envid_t fsenv;
	if (fsenv == 0)
  801871:	83 3d 00 40 80 00 00 	cmpl   $0x0,0x804000
  801878:	74 27                	je     8018a1 <fsipc+0x39>
	static_assert(sizeof(fsipcbuf) == PGSIZE);

	if (debug)
		cprintf("[%08x] fsipc %d %08x\n", thisenv->env_id, type, *(uint32_t *)&fsipcbuf);

	ipc_send(fsenv, type, &fsipcbuf, PTE_P | PTE_W | PTE_U);
  80187a:	6a 07                	push   $0x7
  80187c:	68 00 50 80 00       	push   $0x805000
  801881:	56                   	push   %esi
  801882:	ff 35 00 40 80 00    	pushl  0x804000
  801888:	e8 77 f9 ff ff       	call   801204 <ipc_send>
	return ipc_recv(NULL, dstva, NULL);
  80188d:	83 c4 0c             	add    $0xc,%esp
  801890:	6a 00                	push   $0x0
  801892:	53                   	push   %ebx
  801893:	6a 00                	push   $0x0
  801895:	e8 e9 f8 ff ff       	call   801183 <ipc_recv>
}
  80189a:	8d 65 f8             	lea    -0x8(%ebp),%esp
  80189d:	5b                   	pop    %ebx
  80189e:	5e                   	pop    %esi
  80189f:	5d                   	pop    %ebp
  8018a0:	c3                   	ret    
		fsenv = ipc_find_env(ENV_TYPE_FS);
  8018a1:	83 ec 0c             	sub    $0xc,%esp
  8018a4:	6a 01                	push   $0x1
  8018a6:	e8 b1 f9 ff ff       	call   80125c <ipc_find_env>
  8018ab:	a3 00 40 80 00       	mov    %eax,0x804000
  8018b0:	83 c4 10             	add    $0x10,%esp
  8018b3:	eb c5                	jmp    80187a <fsipc+0x12>

008018b5 <devfile_trunc>:
}

// Truncate or extend an open file to 'size' bytes
static int
devfile_trunc(struct Fd *fd, off_t newsize)
{
  8018b5:	f3 0f 1e fb          	endbr32 
  8018b9:	55                   	push   %ebp
  8018ba:	89 e5                	mov    %esp,%ebp
  8018bc:	83 ec 08             	sub    $0x8,%esp
	fsipcbuf.set_size.req_fileid = fd->fd_file.id;
  8018bf:	8b 45 08             	mov    0x8(%ebp),%eax
  8018c2:	8b 40 0c             	mov    0xc(%eax),%eax
  8018c5:	a3 00 50 80 00       	mov    %eax,0x805000
	fsipcbuf.set_size.req_size = newsize;
  8018ca:	8b 45 0c             	mov    0xc(%ebp),%eax
  8018cd:	a3 04 50 80 00       	mov    %eax,0x805004
	return fsipc(FSREQ_SET_SIZE, NULL);
  8018d2:	ba 00 00 00 00       	mov    $0x0,%edx
  8018d7:	b8 02 00 00 00       	mov    $0x2,%eax
  8018dc:	e8 87 ff ff ff       	call   801868 <fsipc>
}
  8018e1:	c9                   	leave  
  8018e2:	c3                   	ret    

008018e3 <devfile_flush>:
{
  8018e3:	f3 0f 1e fb          	endbr32 
  8018e7:	55                   	push   %ebp
  8018e8:	89 e5                	mov    %esp,%ebp
  8018ea:	83 ec 08             	sub    $0x8,%esp
	fsipcbuf.flush.req_fileid = fd->fd_file.id;
  8018ed:	8b 45 08             	mov    0x8(%ebp),%eax
  8018f0:	8b 40 0c             	mov    0xc(%eax),%eax
  8018f3:	a3 00 50 80 00       	mov    %eax,0x805000
	return fsipc(FSREQ_FLUSH, NULL);
  8018f8:	ba 00 00 00 00       	mov    $0x0,%edx
  8018fd:	b8 06 00 00 00       	mov    $0x6,%eax
  801902:	e8 61 ff ff ff       	call   801868 <fsipc>
}
  801907:	c9                   	leave  
  801908:	c3                   	ret    

00801909 <devfile_stat>:
{
  801909:	f3 0f 1e fb          	endbr32 
  80190d:	55                   	push   %ebp
  80190e:	89 e5                	mov    %esp,%ebp
  801910:	53                   	push   %ebx
  801911:	83 ec 04             	sub    $0x4,%esp
  801914:	8b 5d 0c             	mov    0xc(%ebp),%ebx
	fsipcbuf.stat.req_fileid = fd->fd_file.id;
  801917:	8b 45 08             	mov    0x8(%ebp),%eax
  80191a:	8b 40 0c             	mov    0xc(%eax),%eax
  80191d:	a3 00 50 80 00       	mov    %eax,0x805000
	if ((r = fsipc(FSREQ_STAT, NULL)) < 0)
  801922:	ba 00 00 00 00       	mov    $0x0,%edx
  801927:	b8 05 00 00 00       	mov    $0x5,%eax
  80192c:	e8 37 ff ff ff       	call   801868 <fsipc>
  801931:	85 c0                	test   %eax,%eax
  801933:	78 2c                	js     801961 <devfile_stat+0x58>
	strcpy(st->st_name, fsipcbuf.statRet.ret_name);
  801935:	83 ec 08             	sub    $0x8,%esp
  801938:	68 00 50 80 00       	push   $0x805000
  80193d:	53                   	push   %ebx
  80193e:	e8 ac ee ff ff       	call   8007ef <strcpy>
	st->st_size = fsipcbuf.statRet.ret_size;
  801943:	a1 80 50 80 00       	mov    0x805080,%eax
  801948:	89 83 80 00 00 00    	mov    %eax,0x80(%ebx)
	st->st_isdir = fsipcbuf.statRet.ret_isdir;
  80194e:	a1 84 50 80 00       	mov    0x805084,%eax
  801953:	89 83 84 00 00 00    	mov    %eax,0x84(%ebx)
	return 0;
  801959:	83 c4 10             	add    $0x10,%esp
  80195c:	b8 00 00 00 00       	mov    $0x0,%eax
}
  801961:	8b 5d fc             	mov    -0x4(%ebp),%ebx
  801964:	c9                   	leave  
  801965:	c3                   	ret    

00801966 <devfile_write>:
{
  801966:	f3 0f 1e fb          	endbr32 
  80196a:	55                   	push   %ebp
  80196b:	89 e5                	mov    %esp,%ebp
  80196d:	83 ec 0c             	sub    $0xc,%esp
  801970:	8b 45 10             	mov    0x10(%ebp),%eax
  801973:	3d f8 0f 00 00       	cmp    $0xff8,%eax
  801978:	ba f8 0f 00 00       	mov    $0xff8,%edx
  80197d:	0f 47 c2             	cmova  %edx,%eax
	fsipcbuf.write.req_fileid = fd->fd_file.id;
  801980:	8b 55 08             	mov    0x8(%ebp),%edx
  801983:	8b 52 0c             	mov    0xc(%edx),%edx
  801986:	89 15 00 50 80 00    	mov    %edx,0x805000
	fsipcbuf.write.req_n = n;
  80198c:	a3 04 50 80 00       	mov    %eax,0x805004
	memmove(fsipcbuf.write.req_buf, buf, n);
  801991:	50                   	push   %eax
  801992:	ff 75 0c             	pushl  0xc(%ebp)
  801995:	68 08 50 80 00       	push   $0x805008
  80199a:	e8 06 f0 ff ff       	call   8009a5 <memmove>
	return fsipc(FSREQ_WRITE, NULL);}
  80199f:	ba 00 00 00 00       	mov    $0x0,%edx
  8019a4:	b8 04 00 00 00       	mov    $0x4,%eax
  8019a9:	e8 ba fe ff ff       	call   801868 <fsipc>
  8019ae:	c9                   	leave  
  8019af:	c3                   	ret    

008019b0 <devfile_read>:
{
  8019b0:	f3 0f 1e fb          	endbr32 
  8019b4:	55                   	push   %ebp
  8019b5:	89 e5                	mov    %esp,%ebp
  8019b7:	56                   	push   %esi
  8019b8:	53                   	push   %ebx
  8019b9:	8b 75 10             	mov    0x10(%ebp),%esi
	fsipcbuf.read.req_fileid = fd->fd_file.id;
  8019bc:	8b 45 08             	mov    0x8(%ebp),%eax
  8019bf:	8b 40 0c             	mov    0xc(%eax),%eax
  8019c2:	a3 00 50 80 00       	mov    %eax,0x805000
	fsipcbuf.read.req_n = n;
  8019c7:	89 35 04 50 80 00    	mov    %esi,0x805004
	if ((r = fsipc(FSREQ_READ, NULL)) < 0)
  8019cd:	ba 00 00 00 00       	mov    $0x0,%edx
  8019d2:	b8 03 00 00 00       	mov    $0x3,%eax
  8019d7:	e8 8c fe ff ff       	call   801868 <fsipc>
  8019dc:	89 c3                	mov    %eax,%ebx
  8019de:	85 c0                	test   %eax,%eax
  8019e0:	78 1f                	js     801a01 <devfile_read+0x51>
	assert(r <= n);
  8019e2:	39 f0                	cmp    %esi,%eax
  8019e4:	77 24                	ja     801a0a <devfile_read+0x5a>
	assert(r <= PGSIZE);
  8019e6:	3d 00 10 00 00       	cmp    $0x1000,%eax
  8019eb:	7f 33                	jg     801a20 <devfile_read+0x70>
	memmove(buf, fsipcbuf.readRet.ret_buf, r);
  8019ed:	83 ec 04             	sub    $0x4,%esp
  8019f0:	50                   	push   %eax
  8019f1:	68 00 50 80 00       	push   $0x805000
  8019f6:	ff 75 0c             	pushl  0xc(%ebp)
  8019f9:	e8 a7 ef ff ff       	call   8009a5 <memmove>
	return r;
  8019fe:	83 c4 10             	add    $0x10,%esp
}
  801a01:	89 d8                	mov    %ebx,%eax
  801a03:	8d 65 f8             	lea    -0x8(%ebp),%esp
  801a06:	5b                   	pop    %ebx
  801a07:	5e                   	pop    %esi
  801a08:	5d                   	pop    %ebp
  801a09:	c3                   	ret    
	assert(r <= n);
  801a0a:	68 08 29 80 00       	push   $0x802908
  801a0f:	68 0f 29 80 00       	push   $0x80290f
  801a14:	6a 7c                	push   $0x7c
  801a16:	68 24 29 80 00       	push   $0x802924
  801a1b:	e8 be 05 00 00       	call   801fde <_panic>
	assert(r <= PGSIZE);
  801a20:	68 2f 29 80 00       	push   $0x80292f
  801a25:	68 0f 29 80 00       	push   $0x80290f
  801a2a:	6a 7d                	push   $0x7d
  801a2c:	68 24 29 80 00       	push   $0x802924
  801a31:	e8 a8 05 00 00       	call   801fde <_panic>

00801a36 <open>:
{
  801a36:	f3 0f 1e fb          	endbr32 
  801a3a:	55                   	push   %ebp
  801a3b:	89 e5                	mov    %esp,%ebp
  801a3d:	56                   	push   %esi
  801a3e:	53                   	push   %ebx
  801a3f:	83 ec 1c             	sub    $0x1c,%esp
  801a42:	8b 75 08             	mov    0x8(%ebp),%esi
	if (strlen(path) >= MAXPATHLEN)
  801a45:	56                   	push   %esi
  801a46:	e8 61 ed ff ff       	call   8007ac <strlen>
  801a4b:	83 c4 10             	add    $0x10,%esp
  801a4e:	3d ff 03 00 00       	cmp    $0x3ff,%eax
  801a53:	7f 6c                	jg     801ac1 <open+0x8b>
	if ((r = fd_alloc(&fd)) < 0)
  801a55:	83 ec 0c             	sub    $0xc,%esp
  801a58:	8d 45 f4             	lea    -0xc(%ebp),%eax
  801a5b:	50                   	push   %eax
  801a5c:	e8 67 f8 ff ff       	call   8012c8 <fd_alloc>
  801a61:	89 c3                	mov    %eax,%ebx
  801a63:	83 c4 10             	add    $0x10,%esp
  801a66:	85 c0                	test   %eax,%eax
  801a68:	78 3c                	js     801aa6 <open+0x70>
	strcpy(fsipcbuf.open.req_path, path);
  801a6a:	83 ec 08             	sub    $0x8,%esp
  801a6d:	56                   	push   %esi
  801a6e:	68 00 50 80 00       	push   $0x805000
  801a73:	e8 77 ed ff ff       	call   8007ef <strcpy>
	fsipcbuf.open.req_omode = mode;
  801a78:	8b 45 0c             	mov    0xc(%ebp),%eax
  801a7b:	a3 00 54 80 00       	mov    %eax,0x805400
	if ((r = fsipc(FSREQ_OPEN, fd)) < 0) {
  801a80:	8b 55 f4             	mov    -0xc(%ebp),%edx
  801a83:	b8 01 00 00 00       	mov    $0x1,%eax
  801a88:	e8 db fd ff ff       	call   801868 <fsipc>
  801a8d:	89 c3                	mov    %eax,%ebx
  801a8f:	83 c4 10             	add    $0x10,%esp
  801a92:	85 c0                	test   %eax,%eax
  801a94:	78 19                	js     801aaf <open+0x79>
	return fd2num(fd);
  801a96:	83 ec 0c             	sub    $0xc,%esp
  801a99:	ff 75 f4             	pushl  -0xc(%ebp)
  801a9c:	e8 f8 f7 ff ff       	call   801299 <fd2num>
  801aa1:	89 c3                	mov    %eax,%ebx
  801aa3:	83 c4 10             	add    $0x10,%esp
}
  801aa6:	89 d8                	mov    %ebx,%eax
  801aa8:	8d 65 f8             	lea    -0x8(%ebp),%esp
  801aab:	5b                   	pop    %ebx
  801aac:	5e                   	pop    %esi
  801aad:	5d                   	pop    %ebp
  801aae:	c3                   	ret    
		fd_close(fd, 0);
  801aaf:	83 ec 08             	sub    $0x8,%esp
  801ab2:	6a 00                	push   $0x0
  801ab4:	ff 75 f4             	pushl  -0xc(%ebp)
  801ab7:	e8 10 f9 ff ff       	call   8013cc <fd_close>
		return r;
  801abc:	83 c4 10             	add    $0x10,%esp
  801abf:	eb e5                	jmp    801aa6 <open+0x70>
		return -E_BAD_PATH;
  801ac1:	bb f4 ff ff ff       	mov    $0xfffffff4,%ebx
  801ac6:	eb de                	jmp    801aa6 <open+0x70>

00801ac8 <sync>:


// Synchronize disk with buffer cache
int
sync(void)
{
  801ac8:	f3 0f 1e fb          	endbr32 
  801acc:	55                   	push   %ebp
  801acd:	89 e5                	mov    %esp,%ebp
  801acf:	83 ec 08             	sub    $0x8,%esp
	// Ask the file server to update the disk
	// by writing any dirty blocks in the buffer cache.

	return fsipc(FSREQ_SYNC, NULL);
  801ad2:	ba 00 00 00 00       	mov    $0x0,%edx
  801ad7:	b8 08 00 00 00       	mov    $0x8,%eax
  801adc:	e8 87 fd ff ff       	call   801868 <fsipc>
}
  801ae1:	c9                   	leave  
  801ae2:	c3                   	ret    

00801ae3 <devpipe_stat>:
	return i;
}

static int
devpipe_stat(struct Fd *fd, struct Stat *stat)
{
  801ae3:	f3 0f 1e fb          	endbr32 
  801ae7:	55                   	push   %ebp
  801ae8:	89 e5                	mov    %esp,%ebp
  801aea:	56                   	push   %esi
  801aeb:	53                   	push   %ebx
  801aec:	8b 5d 0c             	mov    0xc(%ebp),%ebx
	struct Pipe *p = (struct Pipe*) fd2data(fd);
  801aef:	83 ec 0c             	sub    $0xc,%esp
  801af2:	ff 75 08             	pushl  0x8(%ebp)
  801af5:	e8 b3 f7 ff ff       	call   8012ad <fd2data>
  801afa:	89 c6                	mov    %eax,%esi
	strcpy(stat->st_name, "<pipe>");
  801afc:	83 c4 08             	add    $0x8,%esp
  801aff:	68 3b 29 80 00       	push   $0x80293b
  801b04:	53                   	push   %ebx
  801b05:	e8 e5 ec ff ff       	call   8007ef <strcpy>
	stat->st_size = p->p_wpos - p->p_rpos;
  801b0a:	8b 46 04             	mov    0x4(%esi),%eax
  801b0d:	2b 06                	sub    (%esi),%eax
  801b0f:	89 83 80 00 00 00    	mov    %eax,0x80(%ebx)
	stat->st_isdir = 0;
  801b15:	c7 83 84 00 00 00 00 	movl   $0x0,0x84(%ebx)
  801b1c:	00 00 00 
	stat->st_dev = &devpipe;
  801b1f:	c7 83 88 00 00 00 20 	movl   $0x803020,0x88(%ebx)
  801b26:	30 80 00 
	return 0;
}
  801b29:	b8 00 00 00 00       	mov    $0x0,%eax
  801b2e:	8d 65 f8             	lea    -0x8(%ebp),%esp
  801b31:	5b                   	pop    %ebx
  801b32:	5e                   	pop    %esi
  801b33:	5d                   	pop    %ebp
  801b34:	c3                   	ret    

00801b35 <devpipe_close>:

static int
devpipe_close(struct Fd *fd)
{
  801b35:	f3 0f 1e fb          	endbr32 
  801b39:	55                   	push   %ebp
  801b3a:	89 e5                	mov    %esp,%ebp
  801b3c:	53                   	push   %ebx
  801b3d:	83 ec 0c             	sub    $0xc,%esp
  801b40:	8b 5d 08             	mov    0x8(%ebp),%ebx
	(void) sys_page_unmap(0, fd);
  801b43:	53                   	push   %ebx
  801b44:	6a 00                	push   $0x0
  801b46:	e8 73 f1 ff ff       	call   800cbe <sys_page_unmap>
	return sys_page_unmap(0, fd2data(fd));
  801b4b:	89 1c 24             	mov    %ebx,(%esp)
  801b4e:	e8 5a f7 ff ff       	call   8012ad <fd2data>
  801b53:	83 c4 08             	add    $0x8,%esp
  801b56:	50                   	push   %eax
  801b57:	6a 00                	push   $0x0
  801b59:	e8 60 f1 ff ff       	call   800cbe <sys_page_unmap>
}
  801b5e:	8b 5d fc             	mov    -0x4(%ebp),%ebx
  801b61:	c9                   	leave  
  801b62:	c3                   	ret    

00801b63 <_pipeisclosed>:
{
  801b63:	55                   	push   %ebp
  801b64:	89 e5                	mov    %esp,%ebp
  801b66:	57                   	push   %edi
  801b67:	56                   	push   %esi
  801b68:	53                   	push   %ebx
  801b69:	83 ec 1c             	sub    $0x1c,%esp
  801b6c:	89 c7                	mov    %eax,%edi
  801b6e:	89 d6                	mov    %edx,%esi
		n = thisenv->env_runs;
  801b70:	a1 08 40 80 00       	mov    0x804008,%eax
  801b75:	8b 58 58             	mov    0x58(%eax),%ebx
		ret = pageref(fd) == pageref(p);
  801b78:	83 ec 0c             	sub    $0xc,%esp
  801b7b:	57                   	push   %edi
  801b7c:	e8 48 05 00 00       	call   8020c9 <pageref>
  801b81:	89 45 e4             	mov    %eax,-0x1c(%ebp)
  801b84:	89 34 24             	mov    %esi,(%esp)
  801b87:	e8 3d 05 00 00       	call   8020c9 <pageref>
		nn = thisenv->env_runs;
  801b8c:	8b 15 08 40 80 00    	mov    0x804008,%edx
  801b92:	8b 4a 58             	mov    0x58(%edx),%ecx
		if (n == nn)
  801b95:	83 c4 10             	add    $0x10,%esp
  801b98:	39 cb                	cmp    %ecx,%ebx
  801b9a:	74 1b                	je     801bb7 <_pipeisclosed+0x54>
		if (n != nn && ret == 1)
  801b9c:	39 45 e4             	cmp    %eax,-0x1c(%ebp)
  801b9f:	75 cf                	jne    801b70 <_pipeisclosed+0xd>
			cprintf("pipe race avoided\n", n, thisenv->env_runs, ret);
  801ba1:	8b 42 58             	mov    0x58(%edx),%eax
  801ba4:	6a 01                	push   $0x1
  801ba6:	50                   	push   %eax
  801ba7:	53                   	push   %ebx
  801ba8:	68 42 29 80 00       	push   $0x802942
  801bad:	e8 64 e6 ff ff       	call   800216 <cprintf>
  801bb2:	83 c4 10             	add    $0x10,%esp
  801bb5:	eb b9                	jmp    801b70 <_pipeisclosed+0xd>
		ret = pageref(fd) == pageref(p);
  801bb7:	39 45 e4             	cmp    %eax,-0x1c(%ebp)
  801bba:	0f 94 c0             	sete   %al
  801bbd:	0f b6 c0             	movzbl %al,%eax
}
  801bc0:	8d 65 f4             	lea    -0xc(%ebp),%esp
  801bc3:	5b                   	pop    %ebx
  801bc4:	5e                   	pop    %esi
  801bc5:	5f                   	pop    %edi
  801bc6:	5d                   	pop    %ebp
  801bc7:	c3                   	ret    

00801bc8 <devpipe_write>:
{
  801bc8:	f3 0f 1e fb          	endbr32 
  801bcc:	55                   	push   %ebp
  801bcd:	89 e5                	mov    %esp,%ebp
  801bcf:	57                   	push   %edi
  801bd0:	56                   	push   %esi
  801bd1:	53                   	push   %ebx
  801bd2:	83 ec 28             	sub    $0x28,%esp
  801bd5:	8b 75 08             	mov    0x8(%ebp),%esi
	p = (struct Pipe*) fd2data(fd);
  801bd8:	56                   	push   %esi
  801bd9:	e8 cf f6 ff ff       	call   8012ad <fd2data>
  801bde:	89 c3                	mov    %eax,%ebx
	for (i = 0; i < n; i++) {
  801be0:	83 c4 10             	add    $0x10,%esp
  801be3:	bf 00 00 00 00       	mov    $0x0,%edi
  801be8:	3b 7d 10             	cmp    0x10(%ebp),%edi
  801beb:	74 4f                	je     801c3c <devpipe_write+0x74>
		while (p->p_wpos >= p->p_rpos + sizeof(p->p_buf)) {
  801bed:	8b 43 04             	mov    0x4(%ebx),%eax
  801bf0:	8b 0b                	mov    (%ebx),%ecx
  801bf2:	8d 51 20             	lea    0x20(%ecx),%edx
  801bf5:	39 d0                	cmp    %edx,%eax
  801bf7:	72 14                	jb     801c0d <devpipe_write+0x45>
			if (_pipeisclosed(fd, p))
  801bf9:	89 da                	mov    %ebx,%edx
  801bfb:	89 f0                	mov    %esi,%eax
  801bfd:	e8 61 ff ff ff       	call   801b63 <_pipeisclosed>
  801c02:	85 c0                	test   %eax,%eax
  801c04:	75 3b                	jne    801c41 <devpipe_write+0x79>
			sys_yield();
  801c06:	e8 03 f0 ff ff       	call   800c0e <sys_yield>
  801c0b:	eb e0                	jmp    801bed <devpipe_write+0x25>
		p->p_buf[p->p_wpos % PIPEBUFSIZ] = buf[i];
  801c0d:	8b 4d 0c             	mov    0xc(%ebp),%ecx
  801c10:	0f b6 0c 39          	movzbl (%ecx,%edi,1),%ecx
  801c14:	88 4d e7             	mov    %cl,-0x19(%ebp)
  801c17:	89 c2                	mov    %eax,%edx
  801c19:	c1 fa 1f             	sar    $0x1f,%edx
  801c1c:	89 d1                	mov    %edx,%ecx
  801c1e:	c1 e9 1b             	shr    $0x1b,%ecx
  801c21:	8d 14 08             	lea    (%eax,%ecx,1),%edx
  801c24:	83 e2 1f             	and    $0x1f,%edx
  801c27:	29 ca                	sub    %ecx,%edx
  801c29:	0f b6 4d e7          	movzbl -0x19(%ebp),%ecx
  801c2d:	88 4c 13 08          	mov    %cl,0x8(%ebx,%edx,1)
		p->p_wpos++;
  801c31:	83 c0 01             	add    $0x1,%eax
  801c34:	89 43 04             	mov    %eax,0x4(%ebx)
	for (i = 0; i < n; i++) {
  801c37:	83 c7 01             	add    $0x1,%edi
  801c3a:	eb ac                	jmp    801be8 <devpipe_write+0x20>
	return i;
  801c3c:	8b 45 10             	mov    0x10(%ebp),%eax
  801c3f:	eb 05                	jmp    801c46 <devpipe_write+0x7e>
				return 0;
  801c41:	b8 00 00 00 00       	mov    $0x0,%eax
}
  801c46:	8d 65 f4             	lea    -0xc(%ebp),%esp
  801c49:	5b                   	pop    %ebx
  801c4a:	5e                   	pop    %esi
  801c4b:	5f                   	pop    %edi
  801c4c:	5d                   	pop    %ebp
  801c4d:	c3                   	ret    

00801c4e <devpipe_read>:
{
  801c4e:	f3 0f 1e fb          	endbr32 
  801c52:	55                   	push   %ebp
  801c53:	89 e5                	mov    %esp,%ebp
  801c55:	57                   	push   %edi
  801c56:	56                   	push   %esi
  801c57:	53                   	push   %ebx
  801c58:	83 ec 18             	sub    $0x18,%esp
  801c5b:	8b 7d 08             	mov    0x8(%ebp),%edi
	p = (struct Pipe*)fd2data(fd);
  801c5e:	57                   	push   %edi
  801c5f:	e8 49 f6 ff ff       	call   8012ad <fd2data>
  801c64:	89 c3                	mov    %eax,%ebx
	for (i = 0; i < n; i++) {
  801c66:	83 c4 10             	add    $0x10,%esp
  801c69:	be 00 00 00 00       	mov    $0x0,%esi
  801c6e:	3b 75 10             	cmp    0x10(%ebp),%esi
  801c71:	75 14                	jne    801c87 <devpipe_read+0x39>
	return i;
  801c73:	8b 45 10             	mov    0x10(%ebp),%eax
  801c76:	eb 02                	jmp    801c7a <devpipe_read+0x2c>
				return i;
  801c78:	89 f0                	mov    %esi,%eax
}
  801c7a:	8d 65 f4             	lea    -0xc(%ebp),%esp
  801c7d:	5b                   	pop    %ebx
  801c7e:	5e                   	pop    %esi
  801c7f:	5f                   	pop    %edi
  801c80:	5d                   	pop    %ebp
  801c81:	c3                   	ret    
			sys_yield();
  801c82:	e8 87 ef ff ff       	call   800c0e <sys_yield>
		while (p->p_rpos == p->p_wpos) {
  801c87:	8b 03                	mov    (%ebx),%eax
  801c89:	3b 43 04             	cmp    0x4(%ebx),%eax
  801c8c:	75 18                	jne    801ca6 <devpipe_read+0x58>
			if (i > 0)
  801c8e:	85 f6                	test   %esi,%esi
  801c90:	75 e6                	jne    801c78 <devpipe_read+0x2a>
			if (_pipeisclosed(fd, p))
  801c92:	89 da                	mov    %ebx,%edx
  801c94:	89 f8                	mov    %edi,%eax
  801c96:	e8 c8 fe ff ff       	call   801b63 <_pipeisclosed>
  801c9b:	85 c0                	test   %eax,%eax
  801c9d:	74 e3                	je     801c82 <devpipe_read+0x34>
				return 0;
  801c9f:	b8 00 00 00 00       	mov    $0x0,%eax
  801ca4:	eb d4                	jmp    801c7a <devpipe_read+0x2c>
		buf[i] = p->p_buf[p->p_rpos % PIPEBUFSIZ];
  801ca6:	99                   	cltd   
  801ca7:	c1 ea 1b             	shr    $0x1b,%edx
  801caa:	01 d0                	add    %edx,%eax
  801cac:	83 e0 1f             	and    $0x1f,%eax
  801caf:	29 d0                	sub    %edx,%eax
  801cb1:	0f b6 44 03 08       	movzbl 0x8(%ebx,%eax,1),%eax
  801cb6:	8b 4d 0c             	mov    0xc(%ebp),%ecx
  801cb9:	88 04 31             	mov    %al,(%ecx,%esi,1)
		p->p_rpos++;
  801cbc:	83 03 01             	addl   $0x1,(%ebx)
	for (i = 0; i < n; i++) {
  801cbf:	83 c6 01             	add    $0x1,%esi
  801cc2:	eb aa                	jmp    801c6e <devpipe_read+0x20>

00801cc4 <pipe>:
{
  801cc4:	f3 0f 1e fb          	endbr32 
  801cc8:	55                   	push   %ebp
  801cc9:	89 e5                	mov    %esp,%ebp
  801ccb:	56                   	push   %esi
  801ccc:	53                   	push   %ebx
  801ccd:	83 ec 1c             	sub    $0x1c,%esp
	if ((r = fd_alloc(&fd0)) < 0
  801cd0:	8d 45 f4             	lea    -0xc(%ebp),%eax
  801cd3:	50                   	push   %eax
  801cd4:	e8 ef f5 ff ff       	call   8012c8 <fd_alloc>
  801cd9:	89 c3                	mov    %eax,%ebx
  801cdb:	83 c4 10             	add    $0x10,%esp
  801cde:	85 c0                	test   %eax,%eax
  801ce0:	0f 88 23 01 00 00    	js     801e09 <pipe+0x145>
	    || (r = sys_page_alloc(0, fd0, PTE_P|PTE_W|PTE_U|PTE_SHARE)) < 0)
  801ce6:	83 ec 04             	sub    $0x4,%esp
  801ce9:	68 07 04 00 00       	push   $0x407
  801cee:	ff 75 f4             	pushl  -0xc(%ebp)
  801cf1:	6a 00                	push   $0x0
  801cf3:	e8 39 ef ff ff       	call   800c31 <sys_page_alloc>
  801cf8:	89 c3                	mov    %eax,%ebx
  801cfa:	83 c4 10             	add    $0x10,%esp
  801cfd:	85 c0                	test   %eax,%eax
  801cff:	0f 88 04 01 00 00    	js     801e09 <pipe+0x145>
	if ((r = fd_alloc(&fd1)) < 0
  801d05:	83 ec 0c             	sub    $0xc,%esp
  801d08:	8d 45 f0             	lea    -0x10(%ebp),%eax
  801d0b:	50                   	push   %eax
  801d0c:	e8 b7 f5 ff ff       	call   8012c8 <fd_alloc>
  801d11:	89 c3                	mov    %eax,%ebx
  801d13:	83 c4 10             	add    $0x10,%esp
  801d16:	85 c0                	test   %eax,%eax
  801d18:	0f 88 db 00 00 00    	js     801df9 <pipe+0x135>
	    || (r = sys_page_alloc(0, fd1, PTE_P|PTE_W|PTE_U|PTE_SHARE)) < 0)
  801d1e:	83 ec 04             	sub    $0x4,%esp
  801d21:	68 07 04 00 00       	push   $0x407
  801d26:	ff 75 f0             	pushl  -0x10(%ebp)
  801d29:	6a 00                	push   $0x0
  801d2b:	e8 01 ef ff ff       	call   800c31 <sys_page_alloc>
  801d30:	89 c3                	mov    %eax,%ebx
  801d32:	83 c4 10             	add    $0x10,%esp
  801d35:	85 c0                	test   %eax,%eax
  801d37:	0f 88 bc 00 00 00    	js     801df9 <pipe+0x135>
	va = fd2data(fd0);
  801d3d:	83 ec 0c             	sub    $0xc,%esp
  801d40:	ff 75 f4             	pushl  -0xc(%ebp)
  801d43:	e8 65 f5 ff ff       	call   8012ad <fd2data>
  801d48:	89 c6                	mov    %eax,%esi
	if ((r = sys_page_alloc(0, va, PTE_P|PTE_W|PTE_U|PTE_SHARE)) < 0)
  801d4a:	83 c4 0c             	add    $0xc,%esp
  801d4d:	68 07 04 00 00       	push   $0x407
  801d52:	50                   	push   %eax
  801d53:	6a 00                	push   $0x0
  801d55:	e8 d7 ee ff ff       	call   800c31 <sys_page_alloc>
  801d5a:	89 c3                	mov    %eax,%ebx
  801d5c:	83 c4 10             	add    $0x10,%esp
  801d5f:	85 c0                	test   %eax,%eax
  801d61:	0f 88 82 00 00 00    	js     801de9 <pipe+0x125>
	if ((r = sys_page_map(0, va, 0, fd2data(fd1), PTE_P|PTE_W|PTE_U|PTE_SHARE)) < 0)
  801d67:	83 ec 0c             	sub    $0xc,%esp
  801d6a:	ff 75 f0             	pushl  -0x10(%ebp)
  801d6d:	e8 3b f5 ff ff       	call   8012ad <fd2data>
  801d72:	c7 04 24 07 04 00 00 	movl   $0x407,(%esp)
  801d79:	50                   	push   %eax
  801d7a:	6a 00                	push   $0x0
  801d7c:	56                   	push   %esi
  801d7d:	6a 00                	push   $0x0
  801d7f:	e8 f4 ee ff ff       	call   800c78 <sys_page_map>
  801d84:	89 c3                	mov    %eax,%ebx
  801d86:	83 c4 20             	add    $0x20,%esp
  801d89:	85 c0                	test   %eax,%eax
  801d8b:	78 4e                	js     801ddb <pipe+0x117>
	fd0->fd_dev_id = devpipe.dev_id;
  801d8d:	a1 20 30 80 00       	mov    0x803020,%eax
  801d92:	8b 55 f4             	mov    -0xc(%ebp),%edx
  801d95:	89 02                	mov    %eax,(%edx)
	fd0->fd_omode = O_RDONLY;
  801d97:	8b 55 f4             	mov    -0xc(%ebp),%edx
  801d9a:	c7 42 08 00 00 00 00 	movl   $0x0,0x8(%edx)
	fd1->fd_dev_id = devpipe.dev_id;
  801da1:	8b 55 f0             	mov    -0x10(%ebp),%edx
  801da4:	89 02                	mov    %eax,(%edx)
	fd1->fd_omode = O_WRONLY;
  801da6:	8b 45 f0             	mov    -0x10(%ebp),%eax
  801da9:	c7 40 08 01 00 00 00 	movl   $0x1,0x8(%eax)
	pfd[0] = fd2num(fd0);
  801db0:	83 ec 0c             	sub    $0xc,%esp
  801db3:	ff 75 f4             	pushl  -0xc(%ebp)
  801db6:	e8 de f4 ff ff       	call   801299 <fd2num>
  801dbb:	8b 4d 08             	mov    0x8(%ebp),%ecx
  801dbe:	89 01                	mov    %eax,(%ecx)
	pfd[1] = fd2num(fd1);
  801dc0:	83 c4 04             	add    $0x4,%esp
  801dc3:	ff 75 f0             	pushl  -0x10(%ebp)
  801dc6:	e8 ce f4 ff ff       	call   801299 <fd2num>
  801dcb:	8b 4d 08             	mov    0x8(%ebp),%ecx
  801dce:	89 41 04             	mov    %eax,0x4(%ecx)
	return 0;
  801dd1:	83 c4 10             	add    $0x10,%esp
  801dd4:	bb 00 00 00 00       	mov    $0x0,%ebx
  801dd9:	eb 2e                	jmp    801e09 <pipe+0x145>
	sys_page_unmap(0, va);
  801ddb:	83 ec 08             	sub    $0x8,%esp
  801dde:	56                   	push   %esi
  801ddf:	6a 00                	push   $0x0
  801de1:	e8 d8 ee ff ff       	call   800cbe <sys_page_unmap>
  801de6:	83 c4 10             	add    $0x10,%esp
	sys_page_unmap(0, fd1);
  801de9:	83 ec 08             	sub    $0x8,%esp
  801dec:	ff 75 f0             	pushl  -0x10(%ebp)
  801def:	6a 00                	push   $0x0
  801df1:	e8 c8 ee ff ff       	call   800cbe <sys_page_unmap>
  801df6:	83 c4 10             	add    $0x10,%esp
	sys_page_unmap(0, fd0);
  801df9:	83 ec 08             	sub    $0x8,%esp
  801dfc:	ff 75 f4             	pushl  -0xc(%ebp)
  801dff:	6a 00                	push   $0x0
  801e01:	e8 b8 ee ff ff       	call   800cbe <sys_page_unmap>
  801e06:	83 c4 10             	add    $0x10,%esp
}
  801e09:	89 d8                	mov    %ebx,%eax
  801e0b:	8d 65 f8             	lea    -0x8(%ebp),%esp
  801e0e:	5b                   	pop    %ebx
  801e0f:	5e                   	pop    %esi
  801e10:	5d                   	pop    %ebp
  801e11:	c3                   	ret    

00801e12 <pipeisclosed>:
{
  801e12:	f3 0f 1e fb          	endbr32 
  801e16:	55                   	push   %ebp
  801e17:	89 e5                	mov    %esp,%ebp
  801e19:	83 ec 20             	sub    $0x20,%esp
	if ((r = fd_lookup(fdnum, &fd)) < 0)
  801e1c:	8d 45 f4             	lea    -0xc(%ebp),%eax
  801e1f:	50                   	push   %eax
  801e20:	ff 75 08             	pushl  0x8(%ebp)
  801e23:	e8 f6 f4 ff ff       	call   80131e <fd_lookup>
  801e28:	83 c4 10             	add    $0x10,%esp
  801e2b:	85 c0                	test   %eax,%eax
  801e2d:	78 18                	js     801e47 <pipeisclosed+0x35>
	p = (struct Pipe*) fd2data(fd);
  801e2f:	83 ec 0c             	sub    $0xc,%esp
  801e32:	ff 75 f4             	pushl  -0xc(%ebp)
  801e35:	e8 73 f4 ff ff       	call   8012ad <fd2data>
  801e3a:	89 c2                	mov    %eax,%edx
	return _pipeisclosed(fd, p);
  801e3c:	8b 45 f4             	mov    -0xc(%ebp),%eax
  801e3f:	e8 1f fd ff ff       	call   801b63 <_pipeisclosed>
  801e44:	83 c4 10             	add    $0x10,%esp
}
  801e47:	c9                   	leave  
  801e48:	c3                   	ret    

00801e49 <devcons_close>:
	return tot;
}

static int
devcons_close(struct Fd *fd)
{
  801e49:	f3 0f 1e fb          	endbr32 
	USED(fd);

	return 0;
}
  801e4d:	b8 00 00 00 00       	mov    $0x0,%eax
  801e52:	c3                   	ret    

00801e53 <devcons_stat>:

static int
devcons_stat(struct Fd *fd, struct Stat *stat)
{
  801e53:	f3 0f 1e fb          	endbr32 
  801e57:	55                   	push   %ebp
  801e58:	89 e5                	mov    %esp,%ebp
  801e5a:	83 ec 10             	sub    $0x10,%esp
	strcpy(stat->st_name, "<cons>");
  801e5d:	68 5a 29 80 00       	push   $0x80295a
  801e62:	ff 75 0c             	pushl  0xc(%ebp)
  801e65:	e8 85 e9 ff ff       	call   8007ef <strcpy>
	return 0;
}
  801e6a:	b8 00 00 00 00       	mov    $0x0,%eax
  801e6f:	c9                   	leave  
  801e70:	c3                   	ret    

00801e71 <devcons_write>:
{
  801e71:	f3 0f 1e fb          	endbr32 
  801e75:	55                   	push   %ebp
  801e76:	89 e5                	mov    %esp,%ebp
  801e78:	57                   	push   %edi
  801e79:	56                   	push   %esi
  801e7a:	53                   	push   %ebx
  801e7b:	81 ec 8c 00 00 00    	sub    $0x8c,%esp
	for (tot = 0; tot < n; tot += m) {
  801e81:	be 00 00 00 00       	mov    $0x0,%esi
		memmove(buf, (char*)vbuf + tot, m);
  801e86:	8d bd 68 ff ff ff    	lea    -0x98(%ebp),%edi
	for (tot = 0; tot < n; tot += m) {
  801e8c:	3b 75 10             	cmp    0x10(%ebp),%esi
  801e8f:	73 31                	jae    801ec2 <devcons_write+0x51>
		m = n - tot;
  801e91:	8b 5d 10             	mov    0x10(%ebp),%ebx
  801e94:	29 f3                	sub    %esi,%ebx
  801e96:	83 fb 7f             	cmp    $0x7f,%ebx
  801e99:	b8 7f 00 00 00       	mov    $0x7f,%eax
  801e9e:	0f 47 d8             	cmova  %eax,%ebx
		memmove(buf, (char*)vbuf + tot, m);
  801ea1:	83 ec 04             	sub    $0x4,%esp
  801ea4:	53                   	push   %ebx
  801ea5:	89 f0                	mov    %esi,%eax
  801ea7:	03 45 0c             	add    0xc(%ebp),%eax
  801eaa:	50                   	push   %eax
  801eab:	57                   	push   %edi
  801eac:	e8 f4 ea ff ff       	call   8009a5 <memmove>
		sys_cputs(buf, m);
  801eb1:	83 c4 08             	add    $0x8,%esp
  801eb4:	53                   	push   %ebx
  801eb5:	57                   	push   %edi
  801eb6:	e8 a6 ec ff ff       	call   800b61 <sys_cputs>
	for (tot = 0; tot < n; tot += m) {
  801ebb:	01 de                	add    %ebx,%esi
  801ebd:	83 c4 10             	add    $0x10,%esp
  801ec0:	eb ca                	jmp    801e8c <devcons_write+0x1b>
}
  801ec2:	89 f0                	mov    %esi,%eax
  801ec4:	8d 65 f4             	lea    -0xc(%ebp),%esp
  801ec7:	5b                   	pop    %ebx
  801ec8:	5e                   	pop    %esi
  801ec9:	5f                   	pop    %edi
  801eca:	5d                   	pop    %ebp
  801ecb:	c3                   	ret    

00801ecc <devcons_read>:
{
  801ecc:	f3 0f 1e fb          	endbr32 
  801ed0:	55                   	push   %ebp
  801ed1:	89 e5                	mov    %esp,%ebp
  801ed3:	83 ec 08             	sub    $0x8,%esp
  801ed6:	b8 00 00 00 00       	mov    $0x0,%eax
	if (n == 0)
  801edb:	83 7d 10 00          	cmpl   $0x0,0x10(%ebp)
  801edf:	74 21                	je     801f02 <devcons_read+0x36>
	while ((c = sys_cgetc()) == 0)
  801ee1:	e8 9d ec ff ff       	call   800b83 <sys_cgetc>
  801ee6:	85 c0                	test   %eax,%eax
  801ee8:	75 07                	jne    801ef1 <devcons_read+0x25>
		sys_yield();
  801eea:	e8 1f ed ff ff       	call   800c0e <sys_yield>
  801eef:	eb f0                	jmp    801ee1 <devcons_read+0x15>
	if (c < 0)
  801ef1:	78 0f                	js     801f02 <devcons_read+0x36>
	if (c == 0x04)	// ctl-d is eof
  801ef3:	83 f8 04             	cmp    $0x4,%eax
  801ef6:	74 0c                	je     801f04 <devcons_read+0x38>
	*(char*)vbuf = c;
  801ef8:	8b 55 0c             	mov    0xc(%ebp),%edx
  801efb:	88 02                	mov    %al,(%edx)
	return 1;
  801efd:	b8 01 00 00 00       	mov    $0x1,%eax
}
  801f02:	c9                   	leave  
  801f03:	c3                   	ret    
		return 0;
  801f04:	b8 00 00 00 00       	mov    $0x0,%eax
  801f09:	eb f7                	jmp    801f02 <devcons_read+0x36>

00801f0b <cputchar>:
{
  801f0b:	f3 0f 1e fb          	endbr32 
  801f0f:	55                   	push   %ebp
  801f10:	89 e5                	mov    %esp,%ebp
  801f12:	83 ec 20             	sub    $0x20,%esp
	char c = ch;
  801f15:	8b 45 08             	mov    0x8(%ebp),%eax
  801f18:	88 45 f7             	mov    %al,-0x9(%ebp)
	sys_cputs(&c, 1);
  801f1b:	6a 01                	push   $0x1
  801f1d:	8d 45 f7             	lea    -0x9(%ebp),%eax
  801f20:	50                   	push   %eax
  801f21:	e8 3b ec ff ff       	call   800b61 <sys_cputs>
}
  801f26:	83 c4 10             	add    $0x10,%esp
  801f29:	c9                   	leave  
  801f2a:	c3                   	ret    

00801f2b <getchar>:
{
  801f2b:	f3 0f 1e fb          	endbr32 
  801f2f:	55                   	push   %ebp
  801f30:	89 e5                	mov    %esp,%ebp
  801f32:	83 ec 1c             	sub    $0x1c,%esp
	r = read(0, &c, 1);
  801f35:	6a 01                	push   $0x1
  801f37:	8d 45 f7             	lea    -0x9(%ebp),%eax
  801f3a:	50                   	push   %eax
  801f3b:	6a 00                	push   $0x0
  801f3d:	e8 5f f6 ff ff       	call   8015a1 <read>
	if (r < 0)
  801f42:	83 c4 10             	add    $0x10,%esp
  801f45:	85 c0                	test   %eax,%eax
  801f47:	78 06                	js     801f4f <getchar+0x24>
	if (r < 1)
  801f49:	74 06                	je     801f51 <getchar+0x26>
	return c;
  801f4b:	0f b6 45 f7          	movzbl -0x9(%ebp),%eax
}
  801f4f:	c9                   	leave  
  801f50:	c3                   	ret    
		return -E_EOF;
  801f51:	b8 f8 ff ff ff       	mov    $0xfffffff8,%eax
  801f56:	eb f7                	jmp    801f4f <getchar+0x24>

00801f58 <iscons>:
{
  801f58:	f3 0f 1e fb          	endbr32 
  801f5c:	55                   	push   %ebp
  801f5d:	89 e5                	mov    %esp,%ebp
  801f5f:	83 ec 20             	sub    $0x20,%esp
	if ((r = fd_lookup(fdnum, &fd)) < 0)
  801f62:	8d 45 f4             	lea    -0xc(%ebp),%eax
  801f65:	50                   	push   %eax
  801f66:	ff 75 08             	pushl  0x8(%ebp)
  801f69:	e8 b0 f3 ff ff       	call   80131e <fd_lookup>
  801f6e:	83 c4 10             	add    $0x10,%esp
  801f71:	85 c0                	test   %eax,%eax
  801f73:	78 11                	js     801f86 <iscons+0x2e>
	return fd->fd_dev_id == devcons.dev_id;
  801f75:	8b 45 f4             	mov    -0xc(%ebp),%eax
  801f78:	8b 15 3c 30 80 00    	mov    0x80303c,%edx
  801f7e:	39 10                	cmp    %edx,(%eax)
  801f80:	0f 94 c0             	sete   %al
  801f83:	0f b6 c0             	movzbl %al,%eax
}
  801f86:	c9                   	leave  
  801f87:	c3                   	ret    

00801f88 <opencons>:
{
  801f88:	f3 0f 1e fb          	endbr32 
  801f8c:	55                   	push   %ebp
  801f8d:	89 e5                	mov    %esp,%ebp
  801f8f:	83 ec 24             	sub    $0x24,%esp
	if ((r = fd_alloc(&fd)) < 0)
  801f92:	8d 45 f4             	lea    -0xc(%ebp),%eax
  801f95:	50                   	push   %eax
  801f96:	e8 2d f3 ff ff       	call   8012c8 <fd_alloc>
  801f9b:	83 c4 10             	add    $0x10,%esp
  801f9e:	85 c0                	test   %eax,%eax
  801fa0:	78 3a                	js     801fdc <opencons+0x54>
	if ((r = sys_page_alloc(0, fd, PTE_P|PTE_U|PTE_W|PTE_SHARE)) < 0)
  801fa2:	83 ec 04             	sub    $0x4,%esp
  801fa5:	68 07 04 00 00       	push   $0x407
  801faa:	ff 75 f4             	pushl  -0xc(%ebp)
  801fad:	6a 00                	push   $0x0
  801faf:	e8 7d ec ff ff       	call   800c31 <sys_page_alloc>
  801fb4:	83 c4 10             	add    $0x10,%esp
  801fb7:	85 c0                	test   %eax,%eax
  801fb9:	78 21                	js     801fdc <opencons+0x54>
	fd->fd_dev_id = devcons.dev_id;
  801fbb:	8b 45 f4             	mov    -0xc(%ebp),%eax
  801fbe:	8b 15 3c 30 80 00    	mov    0x80303c,%edx
  801fc4:	89 10                	mov    %edx,(%eax)
	fd->fd_omode = O_RDWR;
  801fc6:	8b 45 f4             	mov    -0xc(%ebp),%eax
  801fc9:	c7 40 08 02 00 00 00 	movl   $0x2,0x8(%eax)
	return fd2num(fd);
  801fd0:	83 ec 0c             	sub    $0xc,%esp
  801fd3:	50                   	push   %eax
  801fd4:	e8 c0 f2 ff ff       	call   801299 <fd2num>
  801fd9:	83 c4 10             	add    $0x10,%esp
}
  801fdc:	c9                   	leave  
  801fdd:	c3                   	ret    

00801fde <_panic>:
 * It prints "panic: <message>", then causes a breakpoint exception,
 * which causes JOS to enter the JOS kernel monitor.
 */
void
_panic(const char *file, int line, const char *fmt, ...)
{
  801fde:	f3 0f 1e fb          	endbr32 
  801fe2:	55                   	push   %ebp
  801fe3:	89 e5                	mov    %esp,%ebp
  801fe5:	56                   	push   %esi
  801fe6:	53                   	push   %ebx
	va_list ap;

	va_start(ap, fmt);
  801fe7:	8d 5d 14             	lea    0x14(%ebp),%ebx

	// Print the panic message
	cprintf("[%08x] user panic in %s at %s:%d: ",
  801fea:	8b 35 00 30 80 00    	mov    0x803000,%esi
  801ff0:	e8 f6 eb ff ff       	call   800beb <sys_getenvid>
  801ff5:	83 ec 0c             	sub    $0xc,%esp
  801ff8:	ff 75 0c             	pushl  0xc(%ebp)
  801ffb:	ff 75 08             	pushl  0x8(%ebp)
  801ffe:	56                   	push   %esi
  801fff:	50                   	push   %eax
  802000:	68 68 29 80 00       	push   $0x802968
  802005:	e8 0c e2 ff ff       	call   800216 <cprintf>
		sys_getenvid(), binaryname, file, line);
	vcprintf(fmt, ap);
  80200a:	83 c4 18             	add    $0x18,%esp
  80200d:	53                   	push   %ebx
  80200e:	ff 75 10             	pushl  0x10(%ebp)
  802011:	e8 ab e1 ff ff       	call   8001c1 <vcprintf>
	cprintf("\n");
  802016:	c7 04 24 53 29 80 00 	movl   $0x802953,(%esp)
  80201d:	e8 f4 e1 ff ff       	call   800216 <cprintf>
  802022:	83 c4 10             	add    $0x10,%esp

	// Cause a breakpoint exception
	while (1)
		asm volatile("int3");
  802025:	cc                   	int3   
  802026:	eb fd                	jmp    802025 <_panic+0x47>

00802028 <set_pgfault_handler>:
// at UXSTACKTOP), and tell the kernel to call the assembly-language
// _pgfault_upcall routine when a page fault occurs.
//
void
set_pgfault_handler(void (*handler)(struct UTrapframe *utf))
{
  802028:	f3 0f 1e fb          	endbr32 
  80202c:	55                   	push   %ebp
  80202d:	89 e5                	mov    %esp,%ebp
  80202f:	83 ec 08             	sub    $0x8,%esp
	int r;

	if (_pgfault_handler == 0) {
  802032:	83 3d 00 60 80 00 00 	cmpl   $0x0,0x806000
  802039:	74 27                	je     802062 <set_pgfault_handler+0x3a>
		if(sys_page_alloc(0,(void *)UXSTACKTOP-PGSIZE,PTE_W|PTE_U|PTE_P)<0)
			panic("set_pgfault_handler:sys_page_alloc failed");
	}

	// Save handler pointer for assembly to call.
	_pgfault_handler = handler;
  80203b:	8b 45 08             	mov    0x8(%ebp),%eax
  80203e:	a3 00 60 80 00       	mov    %eax,0x806000
	if (sys_env_set_pgfault_upcall(thisenv->env_id,_pgfault_upcall)<0)	
  802043:	a1 08 40 80 00       	mov    0x804008,%eax
  802048:	8b 40 48             	mov    0x48(%eax),%eax
  80204b:	83 ec 08             	sub    $0x8,%esp
  80204e:	68 a2 20 80 00       	push   $0x8020a2
  802053:	50                   	push   %eax
  802054:	e8 37 ed ff ff       	call   800d90 <sys_env_set_pgfault_upcall>
  802059:	83 c4 10             	add    $0x10,%esp
  80205c:	85 c0                	test   %eax,%eax
  80205e:	78 2e                	js     80208e <set_pgfault_handler+0x66>
        panic("set_pgfault_handler:sys_env_set_pgfault_upcall failed");
}
  802060:	c9                   	leave  
  802061:	c3                   	ret    
		if(sys_page_alloc(0,(void *)UXSTACKTOP-PGSIZE,PTE_W|PTE_U|PTE_P)<0)
  802062:	83 ec 04             	sub    $0x4,%esp
  802065:	6a 07                	push   $0x7
  802067:	68 00 f0 bf ee       	push   $0xeebff000
  80206c:	6a 00                	push   $0x0
  80206e:	e8 be eb ff ff       	call   800c31 <sys_page_alloc>
  802073:	83 c4 10             	add    $0x10,%esp
  802076:	85 c0                	test   %eax,%eax
  802078:	79 c1                	jns    80203b <set_pgfault_handler+0x13>
			panic("set_pgfault_handler:sys_page_alloc failed");
  80207a:	83 ec 04             	sub    $0x4,%esp
  80207d:	68 8c 29 80 00       	push   $0x80298c
  802082:	6a 21                	push   $0x21
  802084:	68 ee 29 80 00       	push   $0x8029ee
  802089:	e8 50 ff ff ff       	call   801fde <_panic>
        panic("set_pgfault_handler:sys_env_set_pgfault_upcall failed");
  80208e:	83 ec 04             	sub    $0x4,%esp
  802091:	68 b8 29 80 00       	push   $0x8029b8
  802096:	6a 27                	push   $0x27
  802098:	68 ee 29 80 00       	push   $0x8029ee
  80209d:	e8 3c ff ff ff       	call   801fde <_panic>

008020a2 <_pgfault_upcall>:

.text
.globl _pgfault_upcall
_pgfault_upcall:
	// Call the C page fault handler.
	pushl %esp			// function argument: pointer to UTF
  8020a2:	54                   	push   %esp
	movl _pgfault_handler, %eax
  8020a3:	a1 00 60 80 00       	mov    0x806000,%eax
	call *%eax
  8020a8:	ff d0                	call   *%eax
	addl $4, %esp			// pop function argument
  8020aa:	83 c4 04             	add    $0x4,%esp
	// may find that you have to rearrange your code in non-obvious
	// ways as registers become unavailable as scratch space.
	//
	// LAB 4: Your code here.
	//首先把此时的eip指针下移48个字节因为UTrapFrame的大小是48个字节
	movl 48(%esp), %ebp
  8020ad:	8b 6c 24 30          	mov    0x30(%esp),%ebp
    subl $4, %ebp		// UTrapFrame.utf_esp - 4 and store back 这里是由于之前预留了4个字节。
  8020b1:	83 ed 04             	sub    $0x4,%ebp
    movl %ebp, 48(%esp)	// 返回上一次的esp位置。
  8020b4:	89 6c 24 30          	mov    %ebp,0x30(%esp)

	// Restore the trap-time registers.  After you do this, you
	// can no longer modify any general-purpose registers.
	// LAB 4: Your code here.
	movl 40(%esp), %eax 
  8020b8:	8b 44 24 28          	mov    0x28(%esp),%eax
    movl %eax, (%ebp)
  8020bc:	89 45 00             	mov    %eax,0x0(%ebp)

	// Restore eflags from the stack.  After you do this, you can
	// no longer use arithmetic operations or anything else that
	// modifies eflags.
	// LAB 4: Your code here.
	addl $0x8, %esp         // Set %esp to the end of struct PushRegs
  8020bf:	83 c4 08             	add    $0x8,%esp
	popal                   // Restore the trap-time registers.(struct PushRegs)
  8020c2:	61                   	popa   

	// Switch back to the adjusted trap-time stack.
	// LAB 4: Your code here.
	addl $0x4, %esp         // now we are located at trap-time eip,so we have to increment %esp with 4.【跳过eip】
  8020c3:	83 c4 04             	add    $0x4,%esp
	popfl                   // Restore eflags register.	【pop eflags】
  8020c6:	9d                   	popf   
	popl %esp               // Just restore the adjusted trap-time stack pointer.
  8020c7:	5c                   	pop    %esp
							// 恢复esp

	// Return to re-execute the instruction that faulted.
	// LAB 4: Your code here.
	ret                     // We are now on the trap-time stack,since we have saved trap-time eip above trap-time esp,ret instruction will pop this trap-time eip to register %eip which known as PC at this time.Thus,we can return to re-execute the instruction that faulted.
  8020c8:	c3                   	ret    

008020c9 <pageref>:
#include <inc/lib.h>

int
pageref(void *v)
{
  8020c9:	f3 0f 1e fb          	endbr32 
  8020cd:	55                   	push   %ebp
  8020ce:	89 e5                	mov    %esp,%ebp
  8020d0:	8b 45 08             	mov    0x8(%ebp),%eax
	pte_t pte;

	if (!(uvpd[PDX(v)] & PTE_P))
  8020d3:	89 c2                	mov    %eax,%edx
  8020d5:	c1 ea 16             	shr    $0x16,%edx
  8020d8:	8b 0c 95 00 d0 7b ef 	mov    -0x10843000(,%edx,4),%ecx
		return 0;
  8020df:	ba 00 00 00 00       	mov    $0x0,%edx
	if (!(uvpd[PDX(v)] & PTE_P))
  8020e4:	f6 c1 01             	test   $0x1,%cl
  8020e7:	74 1c                	je     802105 <pageref+0x3c>
	pte = uvpt[PGNUM(v)];
  8020e9:	c1 e8 0c             	shr    $0xc,%eax
  8020ec:	8b 04 85 00 00 40 ef 	mov    -0x10c00000(,%eax,4),%eax
	if (!(pte & PTE_P))
  8020f3:	a8 01                	test   $0x1,%al
  8020f5:	74 0e                	je     802105 <pageref+0x3c>
		return 0;
	return pages[PGNUM(pte)].pp_ref;
  8020f7:	c1 e8 0c             	shr    $0xc,%eax
  8020fa:	0f b7 14 c5 04 00 00 	movzwl -0x10fffffc(,%eax,8),%edx
  802101:	ef 
  802102:	0f b7 d2             	movzwl %dx,%edx
}
  802105:	89 d0                	mov    %edx,%eax
  802107:	5d                   	pop    %ebp
  802108:	c3                   	ret    
  802109:	66 90                	xchg   %ax,%ax
  80210b:	66 90                	xchg   %ax,%ax
  80210d:	66 90                	xchg   %ax,%ax
  80210f:	90                   	nop

00802110 <__udivdi3>:
  802110:	f3 0f 1e fb          	endbr32 
  802114:	55                   	push   %ebp
  802115:	57                   	push   %edi
  802116:	56                   	push   %esi
  802117:	53                   	push   %ebx
  802118:	83 ec 1c             	sub    $0x1c,%esp
  80211b:	8b 54 24 3c          	mov    0x3c(%esp),%edx
  80211f:	8b 6c 24 30          	mov    0x30(%esp),%ebp
  802123:	8b 74 24 34          	mov    0x34(%esp),%esi
  802127:	8b 5c 24 38          	mov    0x38(%esp),%ebx
  80212b:	85 d2                	test   %edx,%edx
  80212d:	75 19                	jne    802148 <__udivdi3+0x38>
  80212f:	39 f3                	cmp    %esi,%ebx
  802131:	76 4d                	jbe    802180 <__udivdi3+0x70>
  802133:	31 ff                	xor    %edi,%edi
  802135:	89 e8                	mov    %ebp,%eax
  802137:	89 f2                	mov    %esi,%edx
  802139:	f7 f3                	div    %ebx
  80213b:	89 fa                	mov    %edi,%edx
  80213d:	83 c4 1c             	add    $0x1c,%esp
  802140:	5b                   	pop    %ebx
  802141:	5e                   	pop    %esi
  802142:	5f                   	pop    %edi
  802143:	5d                   	pop    %ebp
  802144:	c3                   	ret    
  802145:	8d 76 00             	lea    0x0(%esi),%esi
  802148:	39 f2                	cmp    %esi,%edx
  80214a:	76 14                	jbe    802160 <__udivdi3+0x50>
  80214c:	31 ff                	xor    %edi,%edi
  80214e:	31 c0                	xor    %eax,%eax
  802150:	89 fa                	mov    %edi,%edx
  802152:	83 c4 1c             	add    $0x1c,%esp
  802155:	5b                   	pop    %ebx
  802156:	5e                   	pop    %esi
  802157:	5f                   	pop    %edi
  802158:	5d                   	pop    %ebp
  802159:	c3                   	ret    
  80215a:	8d b6 00 00 00 00    	lea    0x0(%esi),%esi
  802160:	0f bd fa             	bsr    %edx,%edi
  802163:	83 f7 1f             	xor    $0x1f,%edi
  802166:	75 48                	jne    8021b0 <__udivdi3+0xa0>
  802168:	39 f2                	cmp    %esi,%edx
  80216a:	72 06                	jb     802172 <__udivdi3+0x62>
  80216c:	31 c0                	xor    %eax,%eax
  80216e:	39 eb                	cmp    %ebp,%ebx
  802170:	77 de                	ja     802150 <__udivdi3+0x40>
  802172:	b8 01 00 00 00       	mov    $0x1,%eax
  802177:	eb d7                	jmp    802150 <__udivdi3+0x40>
  802179:	8d b4 26 00 00 00 00 	lea    0x0(%esi,%eiz,1),%esi
  802180:	89 d9                	mov    %ebx,%ecx
  802182:	85 db                	test   %ebx,%ebx
  802184:	75 0b                	jne    802191 <__udivdi3+0x81>
  802186:	b8 01 00 00 00       	mov    $0x1,%eax
  80218b:	31 d2                	xor    %edx,%edx
  80218d:	f7 f3                	div    %ebx
  80218f:	89 c1                	mov    %eax,%ecx
  802191:	31 d2                	xor    %edx,%edx
  802193:	89 f0                	mov    %esi,%eax
  802195:	f7 f1                	div    %ecx
  802197:	89 c6                	mov    %eax,%esi
  802199:	89 e8                	mov    %ebp,%eax
  80219b:	89 f7                	mov    %esi,%edi
  80219d:	f7 f1                	div    %ecx
  80219f:	89 fa                	mov    %edi,%edx
  8021a1:	83 c4 1c             	add    $0x1c,%esp
  8021a4:	5b                   	pop    %ebx
  8021a5:	5e                   	pop    %esi
  8021a6:	5f                   	pop    %edi
  8021a7:	5d                   	pop    %ebp
  8021a8:	c3                   	ret    
  8021a9:	8d b4 26 00 00 00 00 	lea    0x0(%esi,%eiz,1),%esi
  8021b0:	89 f9                	mov    %edi,%ecx
  8021b2:	b8 20 00 00 00       	mov    $0x20,%eax
  8021b7:	29 f8                	sub    %edi,%eax
  8021b9:	d3 e2                	shl    %cl,%edx
  8021bb:	89 54 24 08          	mov    %edx,0x8(%esp)
  8021bf:	89 c1                	mov    %eax,%ecx
  8021c1:	89 da                	mov    %ebx,%edx
  8021c3:	d3 ea                	shr    %cl,%edx
  8021c5:	8b 4c 24 08          	mov    0x8(%esp),%ecx
  8021c9:	09 d1                	or     %edx,%ecx
  8021cb:	89 f2                	mov    %esi,%edx
  8021cd:	89 4c 24 08          	mov    %ecx,0x8(%esp)
  8021d1:	89 f9                	mov    %edi,%ecx
  8021d3:	d3 e3                	shl    %cl,%ebx
  8021d5:	89 c1                	mov    %eax,%ecx
  8021d7:	d3 ea                	shr    %cl,%edx
  8021d9:	89 f9                	mov    %edi,%ecx
  8021db:	89 5c 24 0c          	mov    %ebx,0xc(%esp)
  8021df:	89 eb                	mov    %ebp,%ebx
  8021e1:	d3 e6                	shl    %cl,%esi
  8021e3:	89 c1                	mov    %eax,%ecx
  8021e5:	d3 eb                	shr    %cl,%ebx
  8021e7:	09 de                	or     %ebx,%esi
  8021e9:	89 f0                	mov    %esi,%eax
  8021eb:	f7 74 24 08          	divl   0x8(%esp)
  8021ef:	89 d6                	mov    %edx,%esi
  8021f1:	89 c3                	mov    %eax,%ebx
  8021f3:	f7 64 24 0c          	mull   0xc(%esp)
  8021f7:	39 d6                	cmp    %edx,%esi
  8021f9:	72 15                	jb     802210 <__udivdi3+0x100>
  8021fb:	89 f9                	mov    %edi,%ecx
  8021fd:	d3 e5                	shl    %cl,%ebp
  8021ff:	39 c5                	cmp    %eax,%ebp
  802201:	73 04                	jae    802207 <__udivdi3+0xf7>
  802203:	39 d6                	cmp    %edx,%esi
  802205:	74 09                	je     802210 <__udivdi3+0x100>
  802207:	89 d8                	mov    %ebx,%eax
  802209:	31 ff                	xor    %edi,%edi
  80220b:	e9 40 ff ff ff       	jmp    802150 <__udivdi3+0x40>
  802210:	8d 43 ff             	lea    -0x1(%ebx),%eax
  802213:	31 ff                	xor    %edi,%edi
  802215:	e9 36 ff ff ff       	jmp    802150 <__udivdi3+0x40>
  80221a:	66 90                	xchg   %ax,%ax
  80221c:	66 90                	xchg   %ax,%ax
  80221e:	66 90                	xchg   %ax,%ax

00802220 <__umoddi3>:
  802220:	f3 0f 1e fb          	endbr32 
  802224:	55                   	push   %ebp
  802225:	57                   	push   %edi
  802226:	56                   	push   %esi
  802227:	53                   	push   %ebx
  802228:	83 ec 1c             	sub    $0x1c,%esp
  80222b:	8b 44 24 3c          	mov    0x3c(%esp),%eax
  80222f:	8b 74 24 30          	mov    0x30(%esp),%esi
  802233:	8b 5c 24 34          	mov    0x34(%esp),%ebx
  802237:	8b 7c 24 38          	mov    0x38(%esp),%edi
  80223b:	85 c0                	test   %eax,%eax
  80223d:	75 19                	jne    802258 <__umoddi3+0x38>
  80223f:	39 df                	cmp    %ebx,%edi
  802241:	76 5d                	jbe    8022a0 <__umoddi3+0x80>
  802243:	89 f0                	mov    %esi,%eax
  802245:	89 da                	mov    %ebx,%edx
  802247:	f7 f7                	div    %edi
  802249:	89 d0                	mov    %edx,%eax
  80224b:	31 d2                	xor    %edx,%edx
  80224d:	83 c4 1c             	add    $0x1c,%esp
  802250:	5b                   	pop    %ebx
  802251:	5e                   	pop    %esi
  802252:	5f                   	pop    %edi
  802253:	5d                   	pop    %ebp
  802254:	c3                   	ret    
  802255:	8d 76 00             	lea    0x0(%esi),%esi
  802258:	89 f2                	mov    %esi,%edx
  80225a:	39 d8                	cmp    %ebx,%eax
  80225c:	76 12                	jbe    802270 <__umoddi3+0x50>
  80225e:	89 f0                	mov    %esi,%eax
  802260:	89 da                	mov    %ebx,%edx
  802262:	83 c4 1c             	add    $0x1c,%esp
  802265:	5b                   	pop    %ebx
  802266:	5e                   	pop    %esi
  802267:	5f                   	pop    %edi
  802268:	5d                   	pop    %ebp
  802269:	c3                   	ret    
  80226a:	8d b6 00 00 00 00    	lea    0x0(%esi),%esi
  802270:	0f bd e8             	bsr    %eax,%ebp
  802273:	83 f5 1f             	xor    $0x1f,%ebp
  802276:	75 50                	jne    8022c8 <__umoddi3+0xa8>
  802278:	39 d8                	cmp    %ebx,%eax
  80227a:	0f 82 e0 00 00 00    	jb     802360 <__umoddi3+0x140>
  802280:	89 d9                	mov    %ebx,%ecx
  802282:	39 f7                	cmp    %esi,%edi
  802284:	0f 86 d6 00 00 00    	jbe    802360 <__umoddi3+0x140>
  80228a:	89 d0                	mov    %edx,%eax
  80228c:	89 ca                	mov    %ecx,%edx
  80228e:	83 c4 1c             	add    $0x1c,%esp
  802291:	5b                   	pop    %ebx
  802292:	5e                   	pop    %esi
  802293:	5f                   	pop    %edi
  802294:	5d                   	pop    %ebp
  802295:	c3                   	ret    
  802296:	8d b4 26 00 00 00 00 	lea    0x0(%esi,%eiz,1),%esi
  80229d:	8d 76 00             	lea    0x0(%esi),%esi
  8022a0:	89 fd                	mov    %edi,%ebp
  8022a2:	85 ff                	test   %edi,%edi
  8022a4:	75 0b                	jne    8022b1 <__umoddi3+0x91>
  8022a6:	b8 01 00 00 00       	mov    $0x1,%eax
  8022ab:	31 d2                	xor    %edx,%edx
  8022ad:	f7 f7                	div    %edi
  8022af:	89 c5                	mov    %eax,%ebp
  8022b1:	89 d8                	mov    %ebx,%eax
  8022b3:	31 d2                	xor    %edx,%edx
  8022b5:	f7 f5                	div    %ebp
  8022b7:	89 f0                	mov    %esi,%eax
  8022b9:	f7 f5                	div    %ebp
  8022bb:	89 d0                	mov    %edx,%eax
  8022bd:	31 d2                	xor    %edx,%edx
  8022bf:	eb 8c                	jmp    80224d <__umoddi3+0x2d>
  8022c1:	8d b4 26 00 00 00 00 	lea    0x0(%esi,%eiz,1),%esi
  8022c8:	89 e9                	mov    %ebp,%ecx
  8022ca:	ba 20 00 00 00       	mov    $0x20,%edx
  8022cf:	29 ea                	sub    %ebp,%edx
  8022d1:	d3 e0                	shl    %cl,%eax
  8022d3:	89 44 24 08          	mov    %eax,0x8(%esp)
  8022d7:	89 d1                	mov    %edx,%ecx
  8022d9:	89 f8                	mov    %edi,%eax
  8022db:	d3 e8                	shr    %cl,%eax
  8022dd:	8b 4c 24 08          	mov    0x8(%esp),%ecx
  8022e1:	89 54 24 04          	mov    %edx,0x4(%esp)
  8022e5:	8b 54 24 04          	mov    0x4(%esp),%edx
  8022e9:	09 c1                	or     %eax,%ecx
  8022eb:	89 d8                	mov    %ebx,%eax
  8022ed:	89 4c 24 08          	mov    %ecx,0x8(%esp)
  8022f1:	89 e9                	mov    %ebp,%ecx
  8022f3:	d3 e7                	shl    %cl,%edi
  8022f5:	89 d1                	mov    %edx,%ecx
  8022f7:	d3 e8                	shr    %cl,%eax
  8022f9:	89 e9                	mov    %ebp,%ecx
  8022fb:	89 7c 24 0c          	mov    %edi,0xc(%esp)
  8022ff:	d3 e3                	shl    %cl,%ebx
  802301:	89 c7                	mov    %eax,%edi
  802303:	89 d1                	mov    %edx,%ecx
  802305:	89 f0                	mov    %esi,%eax
  802307:	d3 e8                	shr    %cl,%eax
  802309:	89 e9                	mov    %ebp,%ecx
  80230b:	89 fa                	mov    %edi,%edx
  80230d:	d3 e6                	shl    %cl,%esi
  80230f:	09 d8                	or     %ebx,%eax
  802311:	f7 74 24 08          	divl   0x8(%esp)
  802315:	89 d1                	mov    %edx,%ecx
  802317:	89 f3                	mov    %esi,%ebx
  802319:	f7 64 24 0c          	mull   0xc(%esp)
  80231d:	89 c6                	mov    %eax,%esi
  80231f:	89 d7                	mov    %edx,%edi
  802321:	39 d1                	cmp    %edx,%ecx
  802323:	72 06                	jb     80232b <__umoddi3+0x10b>
  802325:	75 10                	jne    802337 <__umoddi3+0x117>
  802327:	39 c3                	cmp    %eax,%ebx
  802329:	73 0c                	jae    802337 <__umoddi3+0x117>
  80232b:	2b 44 24 0c          	sub    0xc(%esp),%eax
  80232f:	1b 54 24 08          	sbb    0x8(%esp),%edx
  802333:	89 d7                	mov    %edx,%edi
  802335:	89 c6                	mov    %eax,%esi
  802337:	89 ca                	mov    %ecx,%edx
  802339:	0f b6 4c 24 04       	movzbl 0x4(%esp),%ecx
  80233e:	29 f3                	sub    %esi,%ebx
  802340:	19 fa                	sbb    %edi,%edx
  802342:	89 d0                	mov    %edx,%eax
  802344:	d3 e0                	shl    %cl,%eax
  802346:	89 e9                	mov    %ebp,%ecx
  802348:	d3 eb                	shr    %cl,%ebx
  80234a:	d3 ea                	shr    %cl,%edx
  80234c:	09 d8                	or     %ebx,%eax
  80234e:	83 c4 1c             	add    $0x1c,%esp
  802351:	5b                   	pop    %ebx
  802352:	5e                   	pop    %esi
  802353:	5f                   	pop    %edi
  802354:	5d                   	pop    %ebp
  802355:	c3                   	ret    
  802356:	8d b4 26 00 00 00 00 	lea    0x0(%esi,%eiz,1),%esi
  80235d:	8d 76 00             	lea    0x0(%esi),%esi
  802360:	29 fe                	sub    %edi,%esi
  802362:	19 c3                	sbb    %eax,%ebx
  802364:	89 f2                	mov    %esi,%edx
  802366:	89 d9                	mov    %ebx,%ecx
  802368:	e9 1d ff ff ff       	jmp    80228a <__umoddi3+0x6a>
